local a=ds:GetOrderedDataStore("\076\066")players.PlayerAdded:Connect(function(a)local U=Instance.new("\070\111\108\100\101\114")U.Name="\108\101\097\100\101\114\115\116\097\116\115"U.Parent=a local q=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")q.Name="\067\097\115\104"q.Parent=U local y=Instance.new("\078\117\109\098\101\114\086\097\108\117\101")y.Name="\067"y.Parent=U end)while true do for U,q in pairs(players:GetPlayers())do local y,i=pcall(function()a:SetAsync(q.UserId,q.leaderstats.Coins.Value)end)end task.wait(220)end
--
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
