local unions = {} function DefineForUnion() -- local things = game.Workspace:GetChildren() for thing in #things do if thing.className == "UnionOperation" then table.insert(thing) end end end
It gives the error: "attempted to call a number value".
Any suggestions?
You have a couple thing wrong.
table.insert
takes 2 arguments, the table and thing you want to insert.
example:
local Table = {} table.insert(Table,"Hello")
The for loop you were using is not the best for tables, use a in pairs
loop instead.
Here is a fixed version of your code:
local unions = {} function DefineForUnion() -- local things = game.Workspace:GetChildren() for i , v in pairs (things) do if v.className == "UnionOperation" then table.insert(unions,v) end end end