I have this script that should get the children of a GUI Framehange their background color based on the value BrickColor (Or their name!) However, for some reason it tries to change the properties of the Frame. How can I get it to change the color of the textbuttons inside instead? Thanks for any help
local G = script.Parent
for _,v in pairs(G:GetChildren()) do
local brickcolor = BrickColor.new(v.BrickColor.Value) -- or v.Name
local color = brickcolor.Color
v.BackgroundColor3 = Color3.new(color)
wait(0.1)
script:Destroy()
end
Alternatively--
local G = script.Parent
for i = 1, #(G:GetChildren()) do
local brickcolor = BrickColor.new(G.BrickColor.Value)
local color = brickcolor.Color
G.BackgroundColor3 = Color3.new(color)
wait(0.1)
script:Destroy()
end

2 comments
destroy the script after/outside the for-loop?
It breaks because you destroy the script after setting the color of the first child.