Hello guys, I am trying to change the property of every brick inside a model, the problem is that I don’t know how to do that + that there are multiple layers of models. Do you know how I can do this?
Here is my script that isn’t working:
local panel = script.Parent
local buttons = panel.Buttons
local function Example ()
local Children = buttons:GetChildren()
local CChildren = Children:GetChildren()
for i = 1, #CChildren do
CChildren[i].Color = Color3.fromRGB(255, 0, 0)
print("Changed childrens colors")
end
end
There are 3 layers of models inside the “button model”:
buttons>Left>First>Part1,Part2,Part3.
Alright, so when I did this, I got the “GetDescendents is not a valid member of Model” error, but I solved it with some “adjustments”:
local buttonsC = buttons:GetDescendants()
for index, buttonsC in pairs(buttonsC) do
if buttonsC == nil or not buttonsC:IsA("BasePart") then continue end
buttonsC.Color = Color3.new(0.4, 0, 0)
end
Thanks! // Please let me know if I should’ve done another solution instead, thanks!