I’ve got a working DataStore2 script, and it saves everything as it should except for the player’s inventory. Everything else is a stringvalue, but I need the inventory to be a table of tool names.
This is all my values defined:
local dataArmor = DataStore2("Armor",plr)
local dataStyle = DataStore2("Style",plr)
local dataTaunt = DataStore2("Taunt",plr)
local dataWeapon = DataStore2("Weapon",plr)
local dataTools = DataStore2("ToolDS",plr)
And this is the script segment that tries to load it:
if (dataTools:Get()==nil) then return end
for _,v in pairs(dataTools:Get()) do
print(v)
if require(config).ToolStorage:FindFirstChild(v) then
table.insert(ActualTools, v)
end
end
This returns the “Table expected, got string” error. Because it’s a string, of course.
dataTools is what I want to be a table, but when I try to say:
local dataTools = {
"Kingdom Key",
"Potion",
}
And set it up as a table, it returns an error at this line
if (dataTools:Get()==nil) then return end
Saying “attempt to call a nil value.”
I’m very confused on saving dictionaries to DataStore2, and I’ve looked at all the other posts I can find but none of them seem to work. Any help is appreciated.