Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My loop is not picking up all parts?

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.