#I need help with my tycoon Dropper script

1 messages · Page 1 of 1 (latest)

prime leaf
#

Core script


local mainItems = tycoon:FindFirstChild("MainItems")
local buttons = tycoon:FindFirstChild("Buttons")
local purchasedItems = tycoon:FindFirstChild("PurchasedItems")

local objects = {}

if buttons then
    for i, v in pairs(buttons:GetChildren()) do
        spawn(function()
            if v:FindFirstChild("Button") then

                local newObject = purchasedItems:FindFirstChild(v.Object.Value)
                if newObject ~= nil then
                    objects[newObject.Name] = newObject:Clone()
                    newObject:Destroy()
                else
                    v:Destroy()
                end

                if v:FindFirstChild("Dependency") then
                    v.Button.Transparency = 1
                    v.Button.CanCollide = false
                    v.Button.BillboardGui.Enabled = false
                    coroutine.resume(coroutine.create(function()
                        if purchasedItems:WaitForChild(v.Dependency.Value) then
                            v.Button.Transparency = 0
                            v.Button.CanCollide = true
                            v.Button.BillboardGui.Enabled = true
                        end
                    end))
                end

                v.Button.Touched:Connect(function(hit)
                    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
                    if player then
                        if values.OwnerValue.Value == player then
                            if v.Button.CanCollide == true then
                                if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
                                    player.leaderstats.Cash.Value -= v.Price.Value
                                    objects[v.Object.Value].Parent = purchasedItems
                                    v:Destroy()
                                end
                            end
                        end
                    end
                end)
            end
        end)
    end
end```

  22:03:13.953  Button is not a valid member of Model "Dropper2Button"  -  Server - Core:35
zenith wraith
#

Some values will be stored as nil so to fix it I can show you some parts that could cause that

zenith wraith
#

ok so first

#

for the courentine.resume part

#

hokd on brb

prime leaf
#

okay np

zenith wraith
#

ok so i kindve just edited your whole code in studio

#

do you want me to send it?

prime leaf
#

Yea go for it!

low oceanBOT
#

studio** You are now Level 7! **studio

zenith wraith
#

wont let me send