Datastore 2 questions

Alrighty so, i have a very rudimentary understanding of datastores. I can do them, however, i am experimenting with Datastore2 and i cant get a response on that page. My first question is:

What is Serializing and Deserializing?

What is the best, easiest and fastest way to index the saves through tables?(i have dozens of values i need to store)

Can The data stored in Datastore2 be accessed through the client? because if so that would make some shortcuts for me.

Thanks! :slight_smile:

Explaining


Serializing and deserializing is turning “objects” into IDs and the other way around, saving you some space to the store. This is a common practice for saving items inside inventory.

The best saving is using a table with the values(or folder with values that will be turned into a table) and then obviously serializing tables. Followed by the recommended saving method(Update). Some people have chosen to use multiple data stores for different values. Not necessarily bad.

There is no direct access to the data through client directly. In order to work with the data loading in server, you’ll have to fire remote events to continue.

1 Like

how do you retrieve the previous name of the id? Like in the proper order.

I’m playing with datastore 2 and i understand singular stores, but i cant seem to figure out how to store my tables of data and then load them, and also update those values through the module. I cant get an answer on the main forum for it. :confused:

@Operatik

I usually keep a separate table which reads out the information of what each ID represents. Loading will certainly obtain the information from the fixed table.

i added to my previous statement @Operatik. I appreciate you taking the time to respond.

@Kampfkarren NOTE: THIS IS NOT A SCRIPTING SUPPORT THIS TIME!!! This is only a question regarding a recommendation of use. :slight_smile: :laughing:

So i have about 6 datastores in the datastore2 now, most of which are carrying larger amounts of data, and when players join the game it causes a que build up:

My question is… Should i be using a combine function? And combine all of the stores into one with the DataStore2.Combine()?

It seems pretty simple, but i just wana know if that will contribute to solving my problem, i know that others are telling me in a nother thread i started regarding the que issue, that i should limit the amount of stores i have, but i also know that Datastore 2 is meant to be able to store a bunch of stores.

As said several times in the documentation–yes. This is exactly what’s causing your issues.

2 Likes

For some odd reason when i leave and come back when no one is on the server, it saves the stuff… but if i leave and come back and the server is still open… this happens.

Then you’re not calling :Set when the data changes, or you found a bug. Assuming you’re not using DataStore2 in BindToClose (that would cause this) try and see if you can make a minimal repro case.

Ooo, ok, i’m gonna give that a try… But which datastore2 function should i call in the bind to close? SaveAll()?

And none of the sets in any of the scripts have changed… so, i don’t know what the problem would be there.

Am i doing this right?

function TROA_DATASTORE_SERVICE:MasterStore(Player,THEKEY)
	DataStore2.Combine("TROA&TPP_MasterKey"..key, THEKEY)	 
end

THE KEY is called when the datastores each are finished being created in their respected areas of the script which are called on the players entry into the game.

And sent through like this

    TROA_DATASTORE_SERVICE:MasterStore(Player,"CharInfoStore"..key)

Note that i am using aero game framework.

Don’t use ANY DataStore2 functions in BindToClose or PlayerRemoving. DataStore2 saves for you.

image

I don’t understand! Sometimes it works and sometimes it doesn’t

The most likely scenario is you have something that looks like this:

{
    [1] = "foo",
    [2] = "bar",
    [3] = "baz",
}

…etc. DataStore2 treats this as a dictionary–not an array. You can’t specify the keys if they’re in order.

Then, whats a good solution? This began when i started condensing the amount of stores i have, and began playing with the combined stores stuff.

A good solution for what? Do you have something that looks like that? If so, just remove the keys.