local intv = 1 local pointsGiven = 1 ------------------------------------------- game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Points = Instance.new("IntValue") Points.Name = "Points" Points.Value = 0 Points.Parent = leaderstats end) while wait(intv) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then player.leaderstats.Points.Value = player.leaderstats.Points.Value + pointsGiven end end end
I know, DataStores, but I can't figure out the actual code.
Hello.
There is an easy pre-built feature in roblox's API wich saves Points and loads them.
This can be simply done by replacing Points.Value in PlayerAdded with Points.Value=player:LoadNumber("pts")
And then you just need to add a PlayerRemoving:
game.Players.PlayerRemoving:connect(function(p) p:SaveNumber("pts",p:WaitForChild('leaderstats'):WaitForChild('Points').Value) end)
Have fun and good luck!, marcoantoniosantos3