Hey guys, I was wondering if there were any ways to add tables to folders?
local itemsFound = {burger, ham}
For example, how would you add the above to, say, a folder in the player?
Thanks.
Hey guys, I was wondering if there were any ways to add tables to folders?
local itemsFound = {burger, ham}
For example, how would you add the above to, say, a folder in the player?
Thanks.
If burger and ham are instances and you have the folder set up already, you can do
for _, item in pairs(itemsFound) do
item.Parent = Folder
end
Where Folder
is the variable that contains the folder instance to add the items to
Is adding instances to a folder “bad architecture” and laggy though? Or is it fine?
Not really, if it is required for what you need then it’s okay. Adding instances to a folder is more for organization so I don’t think it’s bad architecture
Are they meant to be strings or objects or what are they meant to be?
They’re meant to be strings, I’m pretty sure.
Ok. I’ll try have a look what I can do now!
Oh they’re strings? The lack of quotation marks made me think they’re instances.
In your case you can have it make stringvalues with the name (and value if you want) being the string itself
for _, item in pairs(itemsFound) do
local value = Instance.new("StringValue")
value.Name = item
value.Value = item
value.Parent = Folder
end
You can’t directly add a table to a folder, you need to make instnaces, in your case, StringValues
Ok… you bet me to it Lol
(3O Characters. Ignore this)
If you want something to happen if the instance has a certain name/value, what is better to check for? Name or value? If that makes sense.
I think honestly you can skip over changing the value to the item as well and just check the name only since they’ll be the same anyways
Do you mean like if somethings an object and not a string? how would you do that?
I don’t understand what you’re asking here, sorry.
Are you meaning if the object inside the table is a CFrame, object or number and not a string how would you insert the correct values for them?
@OPs original statement was if it was better to check the Name or Value in his case since I suggested to change both the name and the value to be the same, which was not really a good idea since if they’re same, checking the name would be better