Do I have to manually save the player’s data when teleporting to a Place?
I don’t know if it may cause some bugs, I have this PlayerRemoving player data saver but I don’t know if with that I’m good or on the contrary I have to manually save the player’s data before teleporting a player to a different place:
game.Players.PlayerRemoving:Connect(function(player)
local profile = Profiles[player]
if profile then
--Add the duration they've played to the data
local duration = tick() - JoinTimes[player]
-- Left time - Join time = Total time played
profile.Data.TotalGameTime += duration
profile.Data.TotalGameTime = FloorNumber(profile.Data.TotalGameTime, 2)
JoinTimes[player] = nil
-- Release the data so other games can load it
profile:Release()
end
end)