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

How do I call all the items in a table?

local gamesStatus = {
	gameHolder.Game_01_.Status, gameHolder.Game_02_.Status, gameHolder.Game_03_.Status, gameHolder.Game_04_.Status, gameHolder.Game_05_.Status,
	gameHolder.Game_06_.Status, gameHolder.Game_07_.Status, gameHolder.Game_08_.Status, gameHolder.Game_09_.Status, gameHolder.Game_10_.Status,
	gameHolder.Game_11_.Status, gameHolder.Game_12_.Status, gameHolder.Game_13_.Status, gameHolder.Game_14_.Status, gameHolder.Game_15_.Status
}

This is my table, Instead of calling 1 item in the table I want to call the full table. Something like

gameStatus.TextColor3 = Color3.new(0,255,0)

instead of

gameStatus[1].TextColor3 = Color3.new(0,255,0)
gameStatus[2].TextColor3 = Color3.new(0,255,0)
gameStatus[3].TextColor3 = Color3.new(0,255,0)

4 comments

0

Please indent your code.

0

how do I indent it

0

Loop.

0

Doesn't work

3 answers

Use a for loop, using v to change the TextColor3.

1 comment

0

How would I do that

This is how you use a for i, v in pairs() loop:

for i, v in pairs(gamesStatus) do
	v.TextColor3 = Color3.new(0, 255, 0)
end

Hope this helps

local gamesStatus = {
 gameHolder.Game_01_.Status, gameHolder.Game_02_.Status, gameHolder.Game_03_.Status, gameHolder.Game_04_.Status, gameHolder.Game_05_.Status,	    gameHolder.Game_06_.Status, gameHolder.Game_07_.Status, gameHolder.Game_08_.Status, gameHolder.Game_09_.Status, gameHolder.Game_10_.Status,	    gameHolder.Game_11_.Status, gameHolder.Game_12_.Status, gameHolder.Game_13_.Status, gameHolder.Game_14_.Status, gameHolder.Game_15_.Status
}

for i, v in pairs(gamesStatus) do
	v.TextColor3 = Color3.new(0, 255, 0)
end

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