Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this script work?

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)

4 comments

0

cause you never made player, so it dosent know what player is. Is this in a localscript or normal?

0

Normal script. How would I create player?

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)

0

sent an answer, try it out.

1 answer

✓ Accepted answer
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.

4 comments

0

Do I put this in a local script?

0

no, just change your current script to this

0

Thanks!

0

np :D

This discussion is preserved as it was. New answers, comments, and votes are closed.