How to remove a table from a table?

Alright so, I’m working on a saving vehicle script for my game, and I’m using a table system like this

local Table = {
		Vehicles = {
			{Model = 'Testing'},
            {Model = 'Testing2'}
		}
	}

How would I go on about removing the second table completely so it would look like this?

local Table = {
		Vehicles = {
			{Model = 'Testing'},
		}
	}

Thank you in advance if you help me,

Table.Vehicles[2] = nil

This would remove the second item in the list and should create your desired table. You can also look into table.remove().

table.remove(Table.Vehicles, 2)

Here is the developer hub reference for tables:
https://developer.roblox.com/articles/Lua-Libraries/table

4 Likes

I haven’t tested this on studio, so if there’s any issues please reply to this.

I would think you could do it like this:

table.remove(Table.Vehicles, 2)