Ad
Log in to vote
1

Is it a good idea to save player's data after every 60 seconds?

Asked by
Soban06 293 Moderation Voter
1 month ago

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)

2 answers

Log in to vote
0
Answered by 1 month ago
Edited 1 month ago

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.
0
There is still the potential of the Get&SetAsync functions failing, of which i have experienced. And oh boy that was not fun. deeskaalstickman649 358 — 1mo
0
It works for be. If its like so. save like in every three mins or so. but not 60. its really unnecessary TheEagle722 114 — 1mo
Ad
Log in to vote
0
Answered by 1 month ago

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.

0
game:BindToClose(function() wait(10) end) In serverstorage will fix it. Bankrovers 23 — 1mo

Answer this question