game.Players.PlayerAdded:connect(function(M)local B=Instance.new("\070\111\108\100\101\114",M)B.Name="\108\101\097\100\101\114\115\116\097\116\115"local S=Instance.new("\073\110\116\086\097\108\117\101",B)S.Name=stat S.Value=ds:GetAsync(M.UserId)or startamount ds:SetAsync(M.UserId,S.Value)S.Changed:connect(function()ds:SetAsync(M.UserId,S.Value)end)end)game.Players.PlayerRemoving:connect(function(M)ds:SetAsync(M.UserId,M.leaderstats.Joins.Value)end)

game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Joins = Instance.new("IntValue",leader)
Joins.Name = stat
Joins.Value = ds:GetAsync(player.UserId) or startamount
ds:SetAsync(player.UserId, Joins.Value)
Joins.Changed:connect(function()
	ds:SetAsync(player.UserId, Joins.Value)
end)
end)

game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Joins.Value) --Change "Points" to the name of your leaderstat.
end)
