I have a normal datastore system. When the player joins, their data will get loaded (GetAsync). When they leave the server, their data will be saved (SetAsync). Simple!
Would I have to worry about DataStore:SetAsync() and :GetAsync() overlapping? I’m worried that there could be a case where a player’s cloud data is loaded on a new session before its previous session was saved (In case the player switches server without leaving the game first)
Therefore, this would cause the previous session data to be lost. Is this possible to happen???
Yes, within Roblox Studio, DataStore:SetAsync() and DataStore:GetAsync() can potentially overlap, especially if they are called simultaneously from different parts of your game’s code or from different players.
I don’t think a player can be in 2 games/servers at the same time. When you press the play button and you are already in a server, the existing instance of Roblox will force quit (aka, leave the game), and then the new instance will join a server. In other words, this will never happen and you don’t have to worry about it.
Also, I have a ;rejoin command in my game and there has been no reports that players have lost their data from using this command (the command teleports the player to the same server by game.JobId, basically rejoining).