Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My loop is not picking up all parts?

Asked by 4 years ago

my get children table is full of parts and it's not picking up mesh parts

for _, part in pairs(workspace:GetChildren) do
    if part.ClassName == "Part" then
        part.BrickColor = BrickColor.random()
    end
end

1 answer

Log in to vote
0
Answered by 4 years ago

You have to use instance:IsA(class) and change Part to BasePart

for _, part in pairs(workspace:GetChildren) do
    if part:IsA("BasePart") then
        part.BrickColor = BrickColor.random()
    end
end
Ad

Answer this question