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

How do you make a table?

How do you make a table and what are they used for in scripting?

3 answers

✓ Accepted answer

Tables are like variables with multiple stuff stored within them.

table = {2,true,"Hello"} -- Tables can store these within them

while true do
	print(table[2]) -- The no. in [ ] is what you want it to print in the table.
	wait(1)
end

--[[
	Printed in Output = true
--]]

for 1 , 3 in pairs do
	print(table[i])
	wait(1)
end

--[[
	Printed in Output = 2
					     = true
					     = Hello
Printed one after the other as i = 1 and v = 3 so it does it 3 times, one after the other.
--]]

Tables are used to hold things together. They usually hold values or keys. They are seperated by a comma**,** or a semicolon**;**.

a = 1 --Explains A used in the table below.
b = 2 --Explains B used in the table below.
c = 3 --Explains C used in the table below.
datable = {a, b, c} --Da Table(lol).

while true do --Just an example using a table.
	print(1, 2, 3) --Prints 1, 2, 3 used above in the table.
	wait(1) --Always wait 1 second before ending a infinite loop.
end

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