As the error is about a table and the data item is the only table what is contained in the data item?
Also as this is a fireclient can you show us the client code that processes this call?
RamJoT makes a good point, only the data variable is the only table you have. The reason this is an issue is because you cannot transfer tables over the server with âmixedâ/ânon-arrayâ keys. So if you use different keys like data[âIDâ], data[3], and data[player], the server wonât pass the table (hence the error). That is why RamJoT would like to see the contents of your data table.
Why donât you just set those to strings then? data[tostring(player.UserId] will abide by what the error is spitting out, and you still keep the same key, just in a different format.
The reason your method doesnât work is you are not providing an array; you listed keys in an unorganized format and not in sequence. Thatâs why player IDâs are not good keys to use in numerical form. By using a string, you are defining a set of keys that donât have a sequence and are of the same data type.
Let me reiterate that an array has a defined order - a sequence - of keys. And they always start at 1, so your data table will look like data[1], data[2], ⌠, data[player1ID], ⌠, data[player2ID], âŚ
In essence, you are leaving holes in the sequence that you have not defined. You cannot do this when you send tables across the server as arrays. That is what the error is trying to tell you. That is why it has to be a string (or some other data type, just not an integer) since an integer key describes arrays. They are called dictionaries but most people just call everything tables here.
If you are still confused, I suggest spending some time here. The wiki goes over the difference between the two types of tables in more depth.
Iâm guessing (and I donât really have a source for this, but itâs based on my common sense so maybe someone can verify) that Roblox doesnât allow disordered arrays to be sent across the server because of the extra data within the holes that are undefined. Something about hundreds of thousands of holes feels like a waste of memory to me in an ordered list.
Iâm not sure, but I think something like that is kind of pointless. Why not just put everything in the table? Then you only need one parameter.
I havenât run into this before because I usually put everything in a table if the data I want to send is a large amount. Perhaps someone with more knowledge regarding this can help explain why your second block doesnât work.