Hi Everyone,
For some reason, I’m getting the wrong length of the table in my code. It’s displaying it as zero which is confusing me a lot.
In this case, in the screenshots I provided I playtest with two players and the game is still printing the wrong table length which is breaking my code.
Maybe I do not understand why it’s doing so, and it is my fault, if so please let me know. In my code I print the table, then the length, then again the entire table just to show that nothing has changed with the table.
Any advice would be appreciated.
for i, player in pairs(Players) do
playerInObby[player.Name] = true
end
for playerName, value in pairs(playerInObby) do
print(playerName..":",value)
end
print(playerInObby)
print(#playerInObby)
print(playerInObby)
The table is declared at the start of my script like this:
local playerInObby = {}
Screenshot of output: