I have a tree of parts where the parent is also a part:
If I want to change the properties of the entire tree, I have to repeat the same instructions for the parent and all descendants:
local function ChangeProp(item)
item.Transparency = 1
item.Color3 = Color3.fromRGB(85, 170, 0)
end
ChangeProp(part)
for _, item in pairs(part:GetDescendants()) do
ChangeProp(item)
end
Are there any GetDescendants commands that include the Parent together?
There isn’t a way to include the parent like that. Your best bet is to just edit the parent’s properties, then loop through the descendants afterwards:
local function ChangeProp(item)
item.Transparency = 1
item.Color3 = Color3.fromRGB(85, 170, 0)
end
ChangeProp(part)
for _, Item in pairs(part:GetDescendants()) do
ChangeProp(item)
end