Can an array full of instances be sent to the client via RemoteEvent?

local NewTable = {}
for Index, Module in pairs (TowerModules) do

    table.insert(NewTable, Module)

end

The code above is attempting to take the values from a dictionary, and insert them into an array. The dictionary is constructed like so:

local TowerModules = {
[1] = Instance1;
[2] = Instance2;
[3] = Instance3;
}

All of the keys are numbers. When the first code iterates through TowerModules dictionary, I am assuming the values of the dictionary are inserted to the new table, with the new table becoming an array since no keys are specified.

The issue is, when I pass the NewTable to the client via RemoteEvent, the result is nil. I have encountered this issue in the past, and it was due to mixed key types. Why would this be happening now? Can instances not be passed?

1 Like

I believe what you are looking for can be found within this article on remote functions and events.

Non-Replicated Instances

If the value being sent is only visible to the sender, nil will be passed instead of the value. For example, if a server tries to pass a descendant of ServerStorage , the client listening to the event will see a nil value because that object isn’t replicated to the client.

2 Likes