Home Game Development scripting – In my Roblox Tycoon sport, my button will not be working

scripting – In my Roblox Tycoon sport, my button will not be working

0
scripting – In my Roblox Tycoon sport, my button will not be working

[ad_1]

I’m a rookie at Lua and Roblox Studio on the whole. I’m trying a simple and fairly easy tutorial on make a fairly good wanting tycoon sport. In my “Core” script, I’m trying to make it so if you press a button, a dropper seems, or regardless of the StringValue has assigned it to (it’s contained in the button mannequin). Right here is the core script:

native tycoon = script.Father or mother.Father or mother

native mainItems = tycoon:FindFirstChild("MainItems")
native values = tycoon:FindFirstChild("Values")

native buttons = tycoon:FindFirstChild("Buttons")
native purchasedItems = tycoon:FindFirstChild("PurchasedItems")

native objects = {}

mainItems.OwnerDoor.Door.Touched:Join(perform(hit)
    if values.OwnerValue.Worth == nil then
        native participant = sport.Gamers:GetPlayerFromCharacter(hit.Father or mother)
        if participant then
            if participant:FindFirstChild("HasTycoon").Worth == false then
                values.OwnerValue.Worth = participant
                mainItems.OwnerDoor.Title.SurfaceGui.TextLabel.Textual content = tostring(values.OwnerValue.Worth).."'s Tycoon"
            finish 
        finish
    finish
finish)


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

                native newObject = purchasedItems:FindFirstChild(v.Object.Worth)
                if newObject ~= nil then
                    objects[newObject.Name] = newObject:Clone()
                    newObject:Destroy()
                else
                    v:Destroy()
                finish

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

                v.Button.Touched:Join(perform(hit)
                    native participant = sport.Gamers:GetPlayerFromCharacter(hit.Father or mother)
                    if participant then
                        if values.OwnerValue.Worth == participant then
                            if v.Button.CanCollide == true then
                                if participant:FindFirstChild("leaderstats").Money.Worth >= v.Value.Worth then
                                    participant.leaderstats.Money.Worth -= v.Value.Worth
                                    objects[v.Object.Value].Father or mother = purchasedItems
                                    v:Destroy()
                                finish
                            finish
                        finish
                    finish
                finish)
            finish
        finish)
    finish
finish

It’s a fairly lengthy script, however my error happens on line 42. In my output, the error reads: Infinite yield attainable on ‘Workspace.Tycoons.Tycoon.PurchasedItems:WaitForChild(“Dropper”)’. Any assist can be extremely appreciated as I’m loving this venture thus far, and I actually wanna get into coding!

Thanks

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here