Hi everyone,
I know how I would set this out if I could set the data structure out beforehand, by doing:
local array = { foldername = {child, child}; foldername = {child, child} }
But how do I do this when I just can't foresee how many folders (or any other object for that matter) and need a variable amount of secondary arrays?
I tried this, but it errors.
local array = {}
for i, v in pairs(sp:GetChildren()) do
if v:IsA("Folder") then
table.insert(array, v)
for _, x in pairs(v:GetChildren()) do
table.insert(array[i], x.Name)
end
end
end
My output:
14:30:01.904 - Workspace.Script:5: bad argument #1 to 'insert' (table expected, got Object)
14:30:01.905 - Script 'Workspace.Script', Line 5
14:30:01.906 - Stack End

1 comment
Thanks! That seems to work.