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 7 years ago
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 '='

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

1 answer

Log in to vote
3
Answered by 7 years ago
Edited 7 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

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


script.Parent.MouseButton1Down:connect(die)

Ad

Answer this question