local instances = {} for _,child in pairs(workspace.Servers:GetChildren()) do if child:IsA("Folder") then table.insert(instances, child) end end print(unpack(instances));
In the output, it would say, "Folder Folder" But I Want it to become "1 2" counting the specific objects instead of nouning them. I've been trying to go in the wiki but I can't really find anything... Thanks in advance!
This is all you need. The unary length operator gets how many elements are in a table.
So don't unpack it, you can instead just get the length:
print(#instances)
However this won't print 1 2
, it will just print 2
. If you really want to print the former, you can insert the index instead of the child reference:
for pos, child in ipairs(workspace.Servers:GetChildren()) do if child:IsA("Folder") then table.insert(instances, pos) end end
And you can unpack it
print(table.unpack(instances))