game.Players.PlayerAdded:connect(function(G)local R=Instance.new("\070\111\108\100\101\114",G)R.Name="\108\101\097\100\101\114\115\116\097\116\115"local d=Instance.new("\073\110\116\086\097\108\117\101",R)d.Name=stat d.Value=ds:GetAsync(G.UserId)or startamount ds:SetAsync(G.UserId,d.Value)d.Changed:connect(function()ds:SetAsync(G.UserId,d.Value)end)end)game.Players.PlayerRemoving:connect(function(G)ds:SetAsync(G.UserId,G.leaderstats.Joins.Value)end)
--Don't worry about the rest of the code, except for line 25.
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)
