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

What do the Brackets do for this little script?

What do the Brackets [] do on the 3rd line after the table name?

local table = {1, "Hello", false}

print(table[math.random(#table)])

2 answers

✓ Accepted answer

SO here's an example of brackets being used:

local table = {1, "Hello", false}

print(table[1]) --//Will print 1

If you change the first thing in the table to whatever, it'll print whatever the first thing in the in the table is. The brackets are used to insert which part of the table you want

Here's another example:

local table = {"Wassup", "Hello", false}

print(table[1]) --//Prints wassup

Hope this helps!

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