How copy every of Instances in workspace using tables

Hi,

So I’m working on something which scans some specific instances in the workspace.

Is it possible to copy specific instances into a one-variable table?

What can I do?

You can insert the instances in the table via table.insert:

local Table = {}

local Part = workspace.Part
local Part2 = workspace.Part2

table.insert(Part, Table) -- Inserting the part into the table
table.insert(Part2, Table) -- Inserting the part into the table

for i, v in ipairs(Table) do
    print(v) -- Will print both parts that were inserted
end
1 Like

Sorry I haven’t mentioned that it is a client-side script.
And it didn’t work.

image

Other way around. It’s table.insert(Table, Part)

1 Like
local Table = {}

local Part = workspace.Part
local Part2 = workspace.Part2

table.insert(Table, Part1) -- Inserting the part into the table
table.insert(Table, Part2) -- Inserting the part into the table

for i, v in ipairs(Table) do
    print(v) -- Will print both parts that were inserted
end