Tables not working?

For some reason tables aren’t working for me. For example, I tried doing:

for i = 1, #holder:GetChildren() do
	print(holder[i])
end

this error pops up:

image

Am I doing anything incorrectly?

holder:GetChildren() is the table, not holder.

Here you treat it as the table, but it’s the instance itself.

For your case you might want a generic for loop anyways

for _, child in ipairs(holder:GetChildren()) do
    print(child)
end
1 Like

replace holder[i] with holder:GetChildren()[i]
this should fix it!

1 Like