Data store is not saving because of the server fast shutdown

how i can use ListVersionsAsync and GetVersionAsync in my script ?
hmm so that will not make any issues ? i see that if a combined them in one key that may cause issues , this is what i exactly save :- {Coins , PotionStorage , GunParts , UsingGunParts , Gears , UsedGears , Potions , i may add more in the future because the game still under development} i think this might be a lot ?

Save them all into one key. You only need this if a player’s data is corrupted, which is very unlikely…

  1. List the versions
local pages = DataStore:ListVersionsAsync(keyYouUseToLoadData, Enum.SortDirection.Descending)
  1. Get the last version
local page = pages:GetCurrentPage()
local entry = page[2] --last entry to the store
  1. Retrieve the version
local data = DataStore:GetVersionAsync(keyYouUseToSaveData, entry.Version)
  1. Check for corruption and use appropriately

Note: you will need pcalls for the data store methods.

1 Like

what about the queue getting stuck ?

dont bother queueing backup data requests the same way you shouldnt bother queueing data get requests. Only queue write requests.

1 Like

i thought that may the auto save loop in each player and in the same time player joins the game , the load function run at the time with the auto save

It could do, if you don’t already, put in a detection system for when data finishes loading, like an attribute or something. Only save if data has loaded.

1 Like

it is now working :face_holding_back_tears: :face_holding_back_tears: , thank you so much for your continuous help i really appreciate it

1 Like