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

How do a place a Limit on how many items a Table can hold?

local table = {}

table.Max = 1 --- why is this not a thing?

2 answers

Solved. The script detects if there are 2 indexes in the table, then it does stuff.

local myTable = {"1","2"}
if #myTable == 2 then
print("There is 2 items in the table")
end

You can just check if the amount of items in the table isn't the max amount.

local table = {'test', 'test2', 'test3'}  --Replace with your table

if #table == 3 then --replace with your table name and max
	print('Max table amount reached')
end

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