game.Players.PlayerRemoving:Connect(function(V)DataStore:SetAsync(V.UserId,V.leaderstats.Coins.Value)end)

game.Players.PlayerRemoving:Connect(function(Player)
	DataStore:SetAsync(Player.UserId, Player.leaderstats.Coins.Value) -- Change "Coins" to the  name of your currency.
end)
