I was thinking maybe making a table of all frames/buttons and then have them all change colour at once. I want to make themes for a GUI, and that includes changing colour of all frames, text buttons, text labels etc, is there any way to do something like table_for_buttons.BackgroundColor = colour or something like that to change all of the buttons colours at once?
just a base to run from, but you are on the right track from your post. Here's a snip to get you started
local stuff = someGUI:GetChildren() -- GetChildren() creates a table of all objects that have someGUI as it's parent. So stuff is now our table for i,v in pairs(stuff) do -- loop through da table and change the objects (v) backgroundcolor v.BackgroundColor3 = Color3.fromRGB(0,0,0) end
There is this cool loop.... You can use, it is called a for loop, here is an example
local PlaceWhereAllButtonsAreKept -- you must define this, must be parent of button for ThisIsA, ForLoop in pairs(PlaceWhereAllButtonsAreKept:GetChildren()) do if ForLoop.ClassName == "TextButton" or "TextLabel" then -- Now you can add the colors... randomized colors... end end
Untested! But for loops literally changes multiple stuff, Have fun, BAIII