How would I change this script so that it changes all of the parts named “Part” within a given model without having to change their names to reference them all individually?
local model = game.Workspace.ModelTest
model.Part.Transparency = 0.5
model.Part.Color = Color3:fromRGB(113,113,113)
What I don’t want to have to do (if possible):
local model = game.Workspace.ModelTest
model.Part1.Transparency = 0.5
model.Part1.Color = Color3:fromRGB(113,113,113)
model.Part2.Transparency = 0.5
model.Part2.Color = Color3:fromRGB(113,113,113)
model.Part3.Transparency = 0.5
model.Part3.Color = Color3:fromRGB(113,113,113)
model.Part4.Transparency = 0.5
model.Part4.Color = Color3:fromRGB(113,113,113)
-- and so on...
local model = game.Workspace.ModelTest
for i, child in ipairs(model:GetChildren()) do
if child.Name == "part" then
child.Transparency = 0.5
child.Color = Color3:fromRGB(113,113,113)
end
end)