What is the best way to save Data?

Hey Developers!
I’m back with a new question.
What do you think guys is the best way to save players Data between the regular DataStore or the DataStore2 by @Kampfkarren ?

I know, it is possible to save Inventory and Pets Data with the DataStore2 but is it possible and is it the same method to save with the Roblox DataStore?

Thx for reading me!

2 Likes

DataStore2 is the same as DataStoreService since the former uses the latter under the hood, though it has benefits like caching, helps prevent data loss, however it cannot guarantee total data loss prevention. I would recommend it if you just need to save player-based data.

DataStoreService does not need to save player-based data so if your data is not tied to a player, use DataStoreService directly.

One is not better than the other. DataStore2 is for player data. DataStoreService can also be for player data but doesn’t strictly need to be used for that.

1 Like

It has been proven that Datastore2 is way better than the built-in Roblox Datastore, in fact it’s almost perfect and will never result into problems. Some people hate Datastore2 because it’s somewhat overrated by certain developers.

I know, it is possible to save Inventory and Pets Data with the DataStore2 but is it possible and is it the same method to save with the Roblox DataStore?

Datastore2 and regular Datastore are the same thing. Datastore2 is just a wrapper for Datatore, which means it uses Datastore but does some stuff to make it better. The only difference is Datastore2 is better. Something can be saved using Datastore2, means it can be saved using Datastore.

1 Like

@Abdelcrepe

DataStore2 is different as it caches and verifies data before saving, it prevents throttling, saves data under keys into the MasterKey as a dictionary.

DataStore2 is built to be used whenever your data actually changes. You shouldn’t invoke DataStore2 in PlayerRemoving at all .

You can also use Get() multiple times to retrieve data

Read :

2 Likes

Why is it better to use it to save player-based data?

Because that is what DataStore2 is desgined to do.

DataStore2(string dataStoreName, Instance player)

That is roughly the “function” (not really a function it’s cuz of __call) signature. It expects a player. The majority of data stores store player data.

1 Like

Thank you for your awnser.
Hmm, I want to make leaderstats variables, and each player will have their own customisable area.
What do you think is the best way to save it?

Use whichever you want. I personally use DataStore2 if it’s player data since that is what it’s for anyways. Also cus im lazy and don’t want to implement retrying logic.

There is not one correct way to save data.

Ok thx you very much !
See ya and have fun!

Hiya! As a developer myself, using folders and datatstores are the best way to save and store data!