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

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

Asked by 8 years ago
1function die()
2if game.Players.LocalPlayer.leadstats.Money.Value = 10 then
3    print ("keem")
4end
5 
6 
7script.Parent.MouseButton1Down:connect(die)

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

0
Is IT rly supposed to be leadstats? 1000anton 38 — 8y
0
No it worked with leaderstats Dumbfounded_Goose -4 — 8y
0
You need ==, and you're missing an end. OldPalHappy 1477 — 8y

1 answer

Log in to vote
3
Answered by 8 years ago
Edited 8 years ago

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

1function die()
2    if game.Players.LocalPlayer.leadstats.Money.Value == 10 then
3        print ("keem")
4    end
5end
6 
7 
8script.Parent.MouseButton1Down:connect(die)
Ad

Answer this question