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

Can you tell me how this doesnt work if its litterly in a localscript?

function die()
if game.Players.LocalPlayer.leadstats.Money.Value = 10 then
	print ("keem")
end


script.Parent.MouseButton1Down:connect(die)

Output: Players.Player1.PlayerGui.ScreenGui.TextButton.LocalScript:2: 'then' expected near '='

3 comments

0

Is IT rly supposed to be leadstats?

0

No it worked with leaderstats

0

You need ==, and you're missing an end.

1 answer

You forgot the end. Also, you have to use "==" on if statements. Using a "=" will make the code think that it's supposed to set a value.

Also, learn how to organize your code, it makes it easy to read, and harder to get lost. See this article:

http://wiki.roblox.com/index.php?title=Writing_Clean_Code

function die()
	if game.Players.LocalPlayer.leadstats.Money.Value == 10 then
	    print ("keem")
	end
end


script.Parent.MouseButton1Down:connect(die)

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