FOREWORD: When you’re posting snippets of code, please enclose them within a code block so it’s easier for us to read. You can achieve this by placing three back ticks before and after your code.
```
-- Code here
```
I’m not quite sure I understand what you’re attempting to achieve. The title states that you’re attempting to save multiple tables to a data store (key?)… what does this mean? Does your model look like
A:
Key | Value |
---|---|
Key1 | {data1, data2} |
or
B:
Key | Value |
---|---|
Key1 | {data1, {data2, data3}} |
Really, you can accomplish this in any number of ways so long as it works.
One method you can choose to use is to split your data between different scopes. Scoping is basically the same as establishing a whole new data store for data, except you’re only changing where it’s coming from. Think of it like subfolders of a bigger folder.
Where you could have
DataStoreService:GetDataStore("MainData")
DataStoreService:GetDataStore("InventoryData")
DataStoreService:GetDataStore("thisisgross")
You could have
DataStoreService:GetDataStore("Data", "Main")
DataStoreService:GetDataStore("Data", "Inventory")
DataStoreService:GetDataStore("Data", "thisonlylooksgoodifyoudoitright")
The second thing you could do is just everything in a table itself. Where a singular table would represent your entire data structure, subtables would represent the various folders that your data is organised in. Every folder name should be a key and the value should be a table including more key-value pairs representing the name and value of a data item.
Key | Value |
---|---|
Data1 | {[“Level”] = 1, [“Yes”] = {[“No”] = “Yes”}} |