Saving a inventory to data stores

Hello, How could I save a table of boolean values to data stores? I have this default table of items the player owns and I want to be able to easily set the value to true when they unlock something and save it.

local Default = {
	["Basic"] = true;
	["Fall"] = false;
	["Stellar"] = false;
}
4 Likes

Is this the whole script for the datastore the table belongs too?

1 Like

I’m not entirely sure what you mean but the table is in the same script as the datastore yeah.

1 Like

maybe module scripts? those are good for tables

1 Like

I am meaning is the table all you have in the script? Do you have a datastore set up with it?

Yeah it is the table but its only meant to set the values for when someone joins for the first time without any data and I do not have data stores set up for it yet.

so u need help with saving the table into the player’s folder?

1 Like

Ok try this to save the data.

To set boolean value to true do something like this
Example:

player.Folder.Basic.Value = true

4 Likes

I suggest using a list, where you can iterate or try to find the item you are looking for. This works better for data usage as you are not storing as much. Lists/tables should be able to work fine with datastores

Has my solution/reply help/solved you problem? Or do u need more help? Please let me know.

Yeah super sorry about that I thought I had marked it as a solution, my bad. Thank you for your help.

1 Like

No worries and no problem :grinning:

This text will be blurred

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.