Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I remove players in tables?

Tables are a very important part of some games. I sometimes even add players to tables! But there is a problem with that. I cant remove the layer from the table. Whenever I print the table, the data looks like:

table: 0x1a7105ac1e83c069

and I don't know how to remove that! I used player, player.Name, player.UserId, everything! please help me, and I would appreciate that!

1 comment

0

You are printing the table address print(table) not the data in the table, you need to use a loop to print data inside the table or index it using arrays.

1 answer

There's two ways of doing this, one way consists of multi-line printing

local table1 = {"Jerry", "Squidward", "Spongebob"}

for _,v in pairs(table1) do
	print(v)
end

Here's another way, with one line printing

local table2 = {"Sandy", "Mr Krabs", "Plankton"}

print(unpack(table2));

To remove you'd do

local table = {"one", "two", "three", "four", "five"}

table.remove(table, 3) -- Would remove the 3rd argument which is "three"

This discussion is preserved as it was. New answers, comments, and votes are closed.