How do you color different parts at the same time?

Hey Everyone!

Does anyone know how to color different parts simultaneously?
For example, let’s say 500 parts are the color yellow and you want to make them all red. What do you do?

Thanks!

Feedback

Select all of them at once then change the colour.

You can change the color with a command script. On Studio there is something in View tab called command that you can write scripts inside. Try that out.

Edit:
To change the part color you need to get the part’s place in Workspace then change its color.
game.Workspace.Part.BrickColor = BrickColor.new(R, G, B)
You can set any number from 0 to 255.

Hierarchical organization is your friend in Roblox Studio. I suggest always making sure similar parts or grouped parts are children under a common parent model. This allows for easier programmatic control over different parts of your game and quicker property changes.

Two Options:

  1. Programmatically change all colors:
local model = -- path to model e.g. workspace.MyModel
local desiredColor = Color3.fromRGB(0, 200, 83) -- a greenish color

function ChangeChildrenColors(modelToChange, colorToApply)
    for i, child in pairs(modelToChange:GetChildren()) do
        if child:IsA("Part") then
            child.Color = colorToApply
        end
    end
end

ChangeChildrenColors(model, desiredColor) -- call the function on your model with the desired color
  1. Parent all of the parts into a model somewhere in the workspace.
    • Right click the model
    • Click ‘Select Children’
    • Open Properties submenu
    • Change color there and it will apply to all of the children of the model
1 Like

In my build I have every part ungrouped, so how would I select all those parts quickly?

1 Like

Click the part all the way at the bottom, then scroll up click the one ontop while holding shift. Then change the color in Properties

I would say to select all of them and then go to color and then change it it should change all the colors same thing with scaling.

To click them quickly press down on your mouse and drag it where you want to select than change what ever setting it is Hope it helped :smiley:

Use a for loop to get all of the parts, and change all of them.
For instance:

local parts = game.Workspace.Parts:GetChildren() --'Parts' is the folder of parts.
for i,v in pairs(parts) do
    local r = math.random(1,255)
    local g = math.random(1,255)
    local b = math.random(1,255)
    v.Color = Color3.fromRGB(r,g,b) --makes a completely random colour
end