Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

so i was making a tycoon from codakid and when i step on a button it will not work i need help?

Asked by
mqop3434 -64
4 years ago
Edited 4 years ago

so here is the script:

local button = script.Parent.Button

function steppedOn(part)

    local character = part.Parent
    local player = game.Players:GetPlayerFromCharacter(character)
    if player and player == script.Parent.Parent.Parent:FindFirstChild('Owner').Value then
            local moneyAmount = player:FindFirstChild('leaderstats'):FindFirstChild('Cash')

            if moneyAmount.Value >= script.Parent.Cost.Value then

            moneyAmount.Value = moneyAmount.Value - script.Parent.Cost.Value

            for i, child in ipairs(script.Parent.Target.Value:GetChildren()) do

                if child.ClassName == 'Part' then

                    child.Transparency = 0
                    if child.Name ~= 'DropLocation' then
                        child.CanCollide = true
                    end

                end

            end
            if script.Parent.Target.Value:FindFirstChild('Activated') then
                script.Parent.Target.Activated.Value = true
            end

            for i, button in ipairs(script.Parent.Unlocks:GetChildren()) do
                button.Value.Button.Transparency = 0
                button.Value.Button.CanCollide = true
            end

            script.Parent:Destroy()

        end

    end

end
button.Touched:Connect(steppedOn)
for i, button in ipairs(script.Parent.Unlocks:GetChildren()) do
    button.Value.Button.Transparency = 1
    button.Value.Button.CanCollide = false
end
  • there is a target on the object
  • i have a script error that says Workspace.Tycoon.Buttons.BuyDropper2.Script:44: attempt to index nil with 'Button'

1 answer

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago

Maybe try changing the value's name inside of the button.

0
i have it at $25 and on the leaderboard i have $25 mqop3434 -64 — 4y
0
what raid6n 2196 — 4y
0
i changed head on local button = script.Parent.Head to script.Parent.Button and it did not work mqop3434 -64 — 4y
0
line 31 raid6n 2196 — 4y
View all comments (10 more)
0
not 1......................... raid6n 2196 — 4y
0
'Part',script mqop3434 -64 — 4y
0
what should it say? mqop3434 -64 — 4y
0
is it on line 3 or 31 mqop3434 -64 — 4y
0
31 and 32 raid6n 2196 — 4y
0
what should it say? mqop3434 -64 — 4y
0
something instead of value just change thename and edit it raid6n 2196 — 4y
0
what mqop3434 -64 — 4y
0
bye raid6n 2196 — 4y
0
back mqop3434 -64 — 4y
Ad

Answer this question