Table.Remove not working?

Hi, I used table.remove to try and remove a player from the table, however, if you look at the screenshot below, after I used table.remove and printed the table it still shows the player instance there? (It also prints nil when using table.find on the table to see if player is there)

1 Like

I’m pretty sure table.remove can only use numbers as its second arguement so you can’t use it in this instance.

Instead just do

local i = table.find(t, plr)
t[i] = nil
1 Like

Instead of typing table.remove(PlayerSlotsActive, table.find(PlayerSlotsActive, Plr)) you should type PlayerSlotsActive[Plr] = nil for this to work properly.

1 Like

You need to explicitly set the key to nil if you have a dictionary. table.remove only accepts a position (number) as the second argument to be removed as pointed out above.

t[plr] = nil

That’s what I can see from the composition of your table from the output.

1 Like