Can the place run with errors?

In short, I needed to create an array in which the rig models were used as a key, and task.spawn as a value. But the main point was that this array was constantly updated with new rigs and therefore it was necessary to use table.insert all the time.

This is what I’m trying to do:

local array = {}
table.insert(array, Instance.new(“part”, workspace), task.spawn(function))

This error is displayed: invalid argument #2 to ‘insert’ (number expected, got Instance)

Although there is an error, the code works like a clock, even in those parts where the array I need appears. Will the code work just as well when I publish the game?

If you feel like doing all that I suggest changing careers.

this is an odd way your trying to set it up but maybe something like this… since the instance isn’t a number position which is what the key should be. use a dictionary not a table

local newInstance = Instance.new(‘Part’, workspace)
array[newInstance] = task.spawn(function)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.