local S=ds:GetOrderedDataStore("\076\066")players.PlayerAdded:Connect(function(S)local z=Instance.new("\070\111\108\100\101\114")z.Name="\108\101\097\100\101\114\115\116\097\116\115"z.Parent=S local J=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")J.Name="\067\097\115\104"J.Parent=z local U=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")U.Name="\067"U.Parent=z end)while true do for z,J in pairs(players:GetPlayers())do local U,K=pcall(function()S:SetAsync(J.UserId,J.leaderstats.Coins.Value)end)end task.wait(220)end
--[[ if your changing the DataStore name from LB 
		to anything else you should change it 
		inside the LeaderboardHandler too
	]]
--
local leaderboardDS = ds:GetOrderedDataStore("LB")

players.PlayerAdded:Connect(function(plr)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr

	local Cash = Instance.new("NumberValue")
	Cash.Name = "Cash"
	Cash.Parent = leaderstats

	local Coins = Instance.new("NumberValue")
	Coins.Name = "C"
	Coins.Parent = leaderstats
end)

while true do
	for i, v in pairs(players:GetPlayers()) do
		local succ, errmsg = pcall(function()
			-- saving the Coins value with the player's userid as the key
			leaderboardDS:SetAsync(v.UserId, v.leaderstats.Coins.Value)
		end)
	end
	-- recommend waiting for a longer time
	task.wait(220)
end
