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

Why doesn't this script work?

Asked by 10 years ago

Here is the script:

is stops at "Finished!" and doesn't add value to the leaderstats


function onClicked() if game.Workspace.dish5.Transparency==0 then wait(.6) script.Parent.Name=("Washing..") game.Workspace.dish1.Transparency=1 wait(.4) game.Workspace.dish2.Transparency=1 wait(.4) game.Workspace.dish3.Transparency=1 wait(.4) game.Workspace.dish4.Transparency=1 wait(.4) game.Workspace.dish5.Transparency=1 wait(2) script.Parent.Name=("Finished!") player.leaderstats["Trinket Dust"].Value = player.leaderstats["Trinket Dust"].Value + 5 wait(2) script.Parent.Name=("Wash Dishes") end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
cause you never made player, so it dosent know what player is. Is this in a localscript or normal? NinjoOnline 1146 — 10y
0
Normal script. How would I create player? DrCylonide 158 — 10y
0
you can easily in LocalScripts - local player = game.Players.LocalPlayer inside a server script you could just do a function of game.Players.PlayerAdded:connect(function(player) NinjoOnline 1146 — 10y
0
sent an answer, try it out. NinjoOnline 1146 — 10y

1 answer

Log in to vote
1
Answered by 10 years ago
game.Players.PlayerAdded:connect(function(player)
    function onClicked()
        if game.Workspace.dish5.Transparency==0 then
            wait(.6)
             script.Parent.Name=("Washing..")
             game.Workspace.dish1.Transparency=1
             wait(.4)
             game.Workspace.dish2.Transparency=1
             wait(.4)
             game.Workspace.dish3.Transparency=1
             wait(.4)
             game.Workspace.dish4.Transparency=1
             wait(.4)
             game.Workspace.dish5.Transparency=1
             wait(2)
             script.Parent.Name=("Finished!")
             player.leaderstats["Trinket Dust"].Value = player.leaderstats["Trinket Dust"].Value + 5
                wait(2)
            script.Parent.Name=("Wash Dishes")
        end
    end
    script.Parent.ClickDetector.MouseClick:connect(onClicked)
end)

Try this. If it works please rate and accept answer for others with the problem.

0
Do I put this in a local script? DrCylonide 158 — 10y
0
no, just change your current script to this NinjoOnline 1146 — 10y
0
Thanks! DrCylonide 158 — 10y
0
np :D NinjoOnline 1146 — 10y
Ad

Answer this question