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

What is wrong with this script? Give point and leaderboard script

Asked by 4 years ago
Edited 4 years ago
game.Players.PlayerAdded:Connect(function(player)
    local stats = Instance.new("Folder", player)
    stats.Name = "leaderstats"
    local points = Instance.new("IntValue",stats)
    points.Name = "Points"
end)


while true do 
    local points = player.leaderstats.Points
    points = points + 1
    wait()
end
0
You have the while true do loop outside of the playeradded function, so you can’t use “player” DarkDanny04 407 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder", player) stats.Name = "leaderstats" local points = Instance.new("IntValue",stats) points.Name = "Points" while true do local points = player.leaderstats.Points points.Value = points.Value + 1 wait() end end)

If you are going to say “player” you must include it in the function that you used the argument in. Outside of the function, “player” has no definition.

You also need to add the +1 to the points, and without saying value, the script thinks you are trying to add numbers to just a variable that has no number correlation.

Hopefully this helps you! :)

Ad

Answer this question