Hi, my for loop isn’t removing everything. There seem to be several values still left in my table. Here is my script:
for i=1,#availableCharacters,1 do
table.remove(availableCharacters, i)
end
Hi, my for loop isn’t removing everything. There seem to be several values still left in my table. Here is my script:
for i=1,#availableCharacters,1 do
table.remove(availableCharacters, i)
end
Fixed, for those who were wondering, I needed to add in a repeat-until like so:
repeat
for i=1,#availableCharacters,1 do
table.remove(availableCharacters, i)
end
until #availableCharacters == 0
You already fixed the problem, but just wanted to point that table.clear(table) is a 1000% more effective way of clearing a table 
That’s a thing? That makes my life way easier. I’ll take a look at it.
It was announced 11 days ago: https://developer.roblox.com/en-us/resources/release-note/Release-Notes-for-456
Added the method table.clear(tb) which empties a table but leaves the prior capacity allocated allowing efficient re-use of Lua tables.
So does it completely clear the table?
As it has been stated, it completely clears the table, but leaves the memory allocated for efficient re-use of it.