game.Players.PlayerAdded:connect(function(g)local F=Instance.new("\070\111\108\100\101\114",g)F.Name="\108\101\097\100\101\114\115\116\097\116\115"local b=Instance.new("\073\110\116\086\097\108\117\101",F)b.Name=stat b.Value=ds:GetAsync(g.UserId)or startamount ds:SetAsync(g.UserId,Money.Value)b.Changed:connect(function()ds:SetAsync(g.UserId,Money.Value)end)end)game.Players.PlayerRemoving:connect(function(g)ds:SetAsync(g.UserId,g.leaderstats.Money.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 Cash = Instance.new("IntValue", leader)
	Cash.Name = stat
	Cash.Value = ds:GetAsync(player.UserId) or startamount
	ds:SetAsync(player.UserId, Money.Value)
	Cash.Changed:connect(function()
		ds:SetAsync(player.UserId, Money.Value)
	end)
end)

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