How to use DataStore2 - Data Store caching and data loss prevention

It’s as character efficient as your serializers are, but unless you’re doing something really really out there, you will never ever ever have to think about the character limit.

Also what if I wanted to use my datastore editor on this? What would the key be and what would the datastore name be?

Search “DataStore2 data store editor” on the forums.

You’re not on the latest version of DataStore2. The free model does not have SaveAll and is not officially recommened anywhere. Update to the latest version as per the documentation.

I switched to the most updated version, but now DataStore2.SaveAll(plr) just returns a different error and still does not save the table.

“DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 345”

1 Like

There is problem in your script I am seeing now.

You’re using datastore2 the wrong way. You should update the datastore when giving item and listen to the callback to give the item to the player etc and not the other way around, what you are doing is updating the inventory table of player and saving it when the player leaves.

I recommend looking into this post of mine.

1 Like

Is there currently a way to get the data of players who are not in the game? This is for the purpose of unbanning and banning players using commands who are not in the same game as you. You’d need to load the data, change it and then save it all while the player may not be in the game. Is this possible?

If you want to get datastore of a player who isn’t in the server, I don’t think its possible as DataStore2 is attached to the player instance.

1 Like

Took a while to get the hang of it, but now that I know how to use it, it has a lot more functionality than just the regular DataStoreService. I wish I used this sooner, it would’ve made everything so much easier to do.

if you’re using standard mode it should work;

Example:

May I ask why you’ve said that you do not officially recommend using SaveAll anywhere but it’s still said to be the recommended way of saving combined data stores on your API docs?

May I ask why you’ve said that you do not officially recommend using SaveAll anywhere

Have I said this? I’d need to know the context behind this.

1 Like

This sentence is an abbreviated way of saying, “The free model does not have SaveAll, and the free model is not officially recommended anywhere.”

2 Likes

I have a few questions concerning datastore2.

  1. Can the “combine” save two of the same-named objects?
  2. Does the “combine” affect anything within ServerStorage?
  3. Are there any other things that I should know about (i.e specific case scenarios.)

yikes, my bad sorry for the trouble.

How would I save multiple values in one store? Would I just make multiple CoinsUpdated functions? Also, should I require the actual module or the Id of the module?

I don’t know what you mean.

No, I don’t know why it would.

Read the documentation.

I don’t understand the question. Just use multiple stores.

Read the documentation.

Ok I fixed it, another question. Can I make leaderboards with datastore 2? Like getting an ordered data store? Thanks :smile:

No, this has been said multiple times for DataStore 2. Same with Profile Service. These aren’t made for OrderedDatastore. Just make a Instance value object and use that for Ordered Datastore.

1 Like

If I am updating a table (which I got from :GetTable()), should I update it by updating its values by using :Set(newTable) or is there another method (other than :Update()) that I should use?