Here's the code i have been using.
game.Players.PlayerRemoving:Connect(function(player)
local Key = "Coins".."-"..player.UserId
pcall(function()
DataStore:SetAsync(Key,player.leaderstats.Coins.Value)
end)
print("DataStoreLog: Data Saving for "..player.Name)
end)
