Always Prefer UpdateAsync Over SetAsync
SetAsync blindly overwrites whatever currently sits in Roblox's cloud storage. UpdateAsync passes you the latest persisted value so you can verify session locks, merge counters safely, and cancel writes if another live server still owns the player's session.
Enforce Session Locking Across Teleport Places
When a player teleports between your lobby and dungeon server, the old server might flush its save slightly after the new server calls GetAsync. Store an active JobId lock inside the player profile and retry with exponential backoff until the previous server releases ownership.
Guard Server Shutdowns with game:BindToClose
Never rely solely on Players.PlayerRemoving during a server crash or developer shutdown. Register a BindToClose callback that iterates through remaining profiles and saves them concurrently using task.spawn before the 30-second shutdown window closes.
Production Luau Reference
task.spawn(function()
end)
end
task.wait(2)
end)