Hi! I’m trying to create a dictionary of data, with the item, and then the array of all of the stats of the item within it. I’m using DataStore2. I’m trying to go through the dictionary, and then loop through the array it gets. So i’m creating a folder for the item stats, and then all the values within it.
This is after i created the store, which is fine:
Consumables_Store:GetTable({
["Simple Potion of Healing"] = {["Description"] = "A Potion of simple healing and stuff", ["Item_Count"] = 3, ["Strength"] = 25, ["Equipped_To_Toolbar"] = false, ["Toolbar_Binding"] = "1"};
["Simple Potion of Energy"] = {["Description"] = "A Potion of simple Energy and stuff", ["Item_Count"] = 5, ["Strength"] = 23, ["Equipped_To_Toolbar"] = false, ["Toolbar_Binding"] = "2"};
})
local Consumables_Store_Gotten = Consumables_Store:Get()
for dicname, dicvalue in pairs(Consumables_Store_Gotten) do
local Item_Folder = Instance.new("Folder")
Item_Folder.Name = dicname
Item_Folder.Parent = Consumables_Folder
print(dicname)
for statname, statvalue in next(dicvalue) do
print(dicname, dicvalue)
if type(statvalue) == 'number' then
local intvalue = Instance.new("NumberValue")
intvalue.Name = statname
intvalue.Value = statvalue
intvalue.Parent = Item_Folder
elseif type(statvalue) == 'boolean' then
local boolvalue = Instance.new("BoolValue")
boolvalue.Name = statname
boolvalue.Value = statvalue
boolvalue.Parent = Item_Folder
elseif type(statvalue) == 'string' then
local stringvalue = Instance.new("StringValue")
stringvalue.Name = statname
stringvalue.Value = statvalue
stringvalue.Parent = Item_Folder
end
end
end
The problem is it errors when it gets to the table, and it wont loop through :*( Can anyone help?