Now I know that you can save values via DataStores whenever the player leaves the game. I have also seen some people on the devforum or on scriptinghelpers making an auto save system which saves the players data every 60 seconds or so.
Now my question:
Let's suppose you implement the above auto save feature via datastores and the data saves after 60 seconds. Now after the data has been saved, the player buys some legendary item in game. And he leaves before the next 60 seconds. So that legendary item won't be saved. So that won't be good experience for the player. So is it really a good idea to save the player's data like this?
Another question:
Should we save player's data on player removing and after every 60 seconds? Or should we just add a 60 seconds interval and no need to save data on player exit (vice versa)?
And if I want to save the player's data every 60 seconds, then can I do it like this that after every 60 seconds, I loop through all the players and run SetAsync()?
What's the point of implementing auto save feature when we can just save player's data when they leave the game?
Thanks for answering my question(s)
No need for the 60 seconds. It would just increase the possibility of lag. save every time when the player insteance removes- good day!
local dataMustBeSaved = 'I dont really exactly know' game.Players.PlayerRemoving:Connect(function(player) Datastore:SetAsync(player, dataMustBeSaved) end) -- ow i wanted to make more ends here. if true then if true then if true then if true then if true then if true then end end end end end end -- better.
From what I have heard saving when a player leaves risks their data of not being saved, apparently this only happens if the player is the last one in the server.
In your situation I'd suggest doing the auto-save every 2-5 minutes, as well as saving if the player leaves the game. As well as this you could save every time a purchase is made, or at any other critical point in your game.