local intv = 1 local pointsGiven = 1 ---------------------------------------------------- function pointGive() while wait(intv) do for _, player in ipairs(game.Players:GetPlayers()) do local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local points = Instance.new("NumberValue", player.leaderstats) points.Name = "Points" if player:FindFirstChild("leaderstats") then player.leaderstats.Points.Value = player.leaderstats.Points.Value + pointsGiven end end end end game.Players.PLayerAdded:connect(pointGive)
This should show up a column in the leader board saying "Points" and the player should be awarded 1 point every second. This isn't doing what I want it to do. I also want this to save for next time the players join.
The problem here is that you already had a leaderboard, and then you where creating a new one, constantly.
Try replacing it with this:
local intv = 1 local pointsGiven = 1 ---------------------------------------------------- function pointGive() while wait(intv) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then player:WaitForChild('leaderstats'):WaitForChild('Points').Value = player.leaderstats.Points.Value + pointsGiven else local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local points = Instance.new("NumberValue", player.leaderstats) points.Name = "Points" end end end end game.Players.PLayerAdded:connect(pointGive)