Give me your example of saving data

That is a different problem entirely. When the datastore itself fails, saving upon a player leaving, and autosave have the same risk of data loss, unless you use a system like datastore2.

But listen. If the data fails to save that moment. The data that saved before gets stored. You are getting as less data prevention as you can.

We must make the event fire when a player leaves so that it saves the data rather than saving it right away especially since there’s a limit

That’s very simple tbh. It’s just roblox datastores that are failing.

Yes, and with a solution like datastore2 you have stored every update to a player’s data, in order to prevent a bad save or race condition from ruining their data.

Does datastore2 use there own database? Or they still store it onto roblox datastore.

It’s kind it’s own data store in a way but yes it runs in the roots of Roblox engine and server

Datastore2 still uses the Roblox datastores, however instead of each player having their own entry in a datastore, each player has a datastore to themselves, in which a new entry is made every time the game is saved. This way, a lost entry doesn’t mean complete data loss, and because there is an ordered data store recording when each save occurred, the most recent entry is used.

What do you mean by it runs in the roots of roblox servers?

the SetAsync() function can be called 10 times per player per minute. (plus an extra 60 per server)

Well why use setasync when there’s updateasync specifically for prevention?

UpdateAsync() is meant to prevent a race condition in which a server changes an entry in a datastore within a short timespan of another server changing the same entry. By having a separate datastore for each player, and keeping timestamps for each save, this can be mitigated separately.

1 Like

Like 2 datastores per player? But one would have to be an ordered datastore.

That is correct. Datastore2 style saving uses a datastore that holds the player data, and an ordered datastore that keeps the timestamps of each save entry. :slight_smile:

Oh. That’s actually a smart way to do it. Now I see. I guess right now it’s harder than you think to make your own datastore/database. I’ll have to use datastore2. Since you cleared that up for me, I see why datastore2 is not bad for saving.

1 Like

Do you know by chance how Nikilis saves his data for Murder Mystery 2 I can imagine he must be saving a lot of data cuz I recall I never heard of him use DataStore2 unless he uses his own way

Deciding how to save data is completely choice based and how it best suits you. I recommend just using a solution that works best for you, I’ve made data handlers in less than 100 lines of code that simply have a :Set() and :Get().

Like everyone else has stated, DataStore2 is a good option though.

1 Like