I need to use the contents of my table and copy them. They are parts in the workspace, however I used
table.insert()
to add it to the table "unions". Here is my code:
unions = {}
function DefineForUnion() --
local things = game.Workspace:GetChildren()
for i , v in pairs (things) do
if v.className == "UnionOperation" then
table.insert(unions,v)
wait(2)
end
end
end
DefineForUnion()
for i, union in pairs (unions) do
print("We found the Unions!")
if (union.ClassName == "UnionOperation") then
local new = union:Clone()
new.Size = union.Size * scale
new.Parent = game.Workspace
new.CFrame = CFrame.new(math.random(1,20),10,math.random(1,20))
print("Copied a union...")
wait(2)
end
However it does not pass the print "We found the unions".
Any suggestions?

3 comments
I've been having similar problems with the 'for' loop, it may be a problem with ROBLOX. :/
Are there actually any UnionOperations directly in the Workspace (not in models?) If you
print(#unions), how many does it say there are?None, however when I add prints to signify what parts of the script actually ran, it shows that the table.insert did run. And. all of the unions are inside the workspace, and are not in a model.