I'm using the PlayerRemoving Event to save Values in a player inside a DataStore, but the Player and the Values get removed so fast, that I can't even read them to save them. Thanks for any help! ;)
function SaveData(Player)
local Key = tostring("Player-"..Player.userId)
local Success, message = pcall(function()
AnimationDataStore:SetAsync(Key,Player.PlayerValues.Animation.Value)
end)
if not Success then
print("An error occurred: " .. message)
end
end
game.Players.PlayerRemoving:connect(function(Player)--On Player removing
SaveData(Player)
end)

2 comments
You could just make a player manually save by pressing a save button.
No, that's no good.