Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How can I make it so in a model all the parts turn the same colour randomly?

Asked by 7 days ago

Hi can someone please help me?

im trying to make a script that gets all the parts from a model and randomly picks one and turns them all the same colour from the Roblox brick colours

thanks

1 answer

Log in to vote
0
Answered by 7 days ago
function changeModelBrickColor(model, brickcolor)
    for i, part in pairs(model:GetDescendants()) do
        if part:IsA("BasePart") then -- Check it is actually a part
            part.BrickColor = brickcolor 

            if part:IsA("UnionOperation") then
                part.UsePartColor = true
            end
        end
    end
end

changeModelBrickColor(game.Workspace.YourModel, BrickColor.Random())

Replace "game.Workspace.YourModel" with the model you want to choose

Replace "BrickColor.Random()" with the brickcolor you want, if you want it to be a random color than don't change it at all

Hope this works!

0
honestly thanks so much I will definitely be using this website more for help you guys are amazing and so talented! Joey111961 0 — 1d
Ad

Answer this question