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

Removing Table Data?

Is there a other way to remove ALL the data like :ClearAllChildren() maybe? (If thats possible) I mean this is NOT a in-game script function yet... But when it does how could I remove all the data with 1 ROBLOX function?

FakeTable={}
table.insert(FakeTable,{Plr=Pl.Name,Tab=Part})

How would I remove every {Plr,Tab} from 1 table other then table.remove()?

3 answers

✓ Accepted answer

Well to remove it from the table, you can iterate over it and set each value to nil. However, you can take the easier approach and just create a new table.

Method 1:

-- Iterate through the table
for key, value in next, tbl do
	tbl[key] = nil;
end

Method 2:

-- Just create a new table
tbl = {};

You need to tell use what you are trying to remove and your attempt in your own script so we can debug your error.

Remove everything in a table? Easy

Method 1:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
Table = {}

Method 2:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
Table[1] = nil
Table[2] = nil
Table[3] = nil
Table[4] = nil
Table[5] = nil
Table[6] = nil
Table[7] = nil
Table[8] = nil
Table[9] = nil
Table[10] = nil
Table[11] = nil
Table[12] = nil
Table[13] = nil
Table[14] = nil

Method 3:

Table = {"HI", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, true, false, game.Workspace.Part}
for i = 1, #Table do
	Table[i] = nil
end

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