Datastore question

What happens if I have a save script in my game that loops through and saves values, but the player’s device dies due to zero battery? Will it save everything until the process is complete and then shut down, or what?

Should i consider using game:bindToClose() or soemthing because saving all the things might take maximum 10 seconds and i want to make sure everything is saved and no data losses happens

saving is done on the server. Bind a save function to when a player leaves and ur good to go. the server wont close until the data is saved

Also it only takes about 1/10 of a second to save unless you are using task.wait() or wait() for some reason

so i should consider using bindtoclose() instead of player.removing? like the values are stored in the player so if it leaves then there will be dataloss right? because the values arent avaible anymore cuz i need the players id and stuff like that?

player.removing will work if the player leaves, crashes, their device dies, etc. BindToClose() is used for when the server is shutdown by roblox (or the dev). ideally you want to have both and make BindToClose() loop trough all players on its event

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.