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

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

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

1 comment

0

You have the while true do loop outside of the playeradded function, so you can’t use “player”

1 answer


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! :)

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