How to make Datastore 2 Inventory System

How i make with datastore2 like a pet system i mean like:
image
that i can add folders to the Pets Folder and it saves the pets like with all values init,
i know how to make that with normal datastores but not with datastore2
Please Help, thx :slight_smile:

2 Likes

You could save them like this:

local bear = {
Evolution = 0,
Equipped = false,
ID = 12345,
Locked = false,
}

local dog = {
Evolution = 0,
Equipped = false,
ID = 54321,
Locked = false,
}

local pets = {bear, dog}

Then just save the pets table. Im not sure how DataStore2 works but Im sure you can save tables :slight_smile:

1 Like

yea you can but then tables in tables its hard in datastore2 idk

1 Like

You can save tables with Set, its the same thing. But I think you have to use the GetTable method for getting tables.

1 Like

but how i make it then with pets

1 Like

I’m not really sure what you mean? You don’t need to save the bear and dog tables too. You just save pets. Pets already saves the bear and dog things for you. Then when they rejoin, somehow get the table (As stated before not sure how this is done in DS2) and use that to set their data.

2 Likes

you need to save it in a table because you need for pets the pet name, the pet id, if its equipped, crafting and more

1 Like