Coloring parts using "GetChildren()"

It still changed only 1 color for some reason…

Is there something else in the ‘Colors’ model in the car? Can you send a screenshot?

Absolutely not, just that

afbeelding

Does this script run when you buy the car? Or when the car already exists (spawned, already parented to a descendant of the workspace)?

local Colors = game.ServerStorage.Cars.Sedan.Body.Colors

for _, child in pairs(Colors:GetChildren()) do
	if child:IsA("BasePart") then
		child.Color = Color3.new(1, 0.666667, 0.498039)
        continue
	end
end

Maybe try this? Check if the child is a base part (class of the part object) then change the colour and use a jump statement to then skip that part and move on.

So it basically clones the car and changed the color, that’s what i did

The parts are unions, to what do i change them, “Union”?

Do you change the color before you clone the car? Or after?

After it clones the car it colors it

1 Like

UnionOperation I believe is the class name for unions

ALright let me try that out.

I’ll inform if works or not

1 Like

Try to color it before you clone the car.

Because you are changing the server storage colors. That means you already have a copy with the old colors.
Or you can loop through the clone’s parts instead.

3 Likes

Try what @LightningLion58 said that should 100% work.

2 Likes

yeah ok let me try that out, I was thinking of this before but i was like naa, lemme try it doe

I meant to post this for other person))

Yeah darn, now it’s just stuck in here.

afbeelding

variable:
local Colors = game.ServerStorage:WaitForChild(‘Cars’):WaitForChild(‘Body’):WaitForChild(‘Colors’)

What? That’s what happened when you cloned before and not after?

ApeRuss were you replying to me or to shabman?

1 Like

Because you didn’t add a WaitForChild() for Sedan and body is a child of sedan

2 Likes

Ohh yeahhhhhhhhh

I’m dumb, lemme try again

I was replying to you about that color before clone, I accidentally missclicked.

1 Like

Yay, it worked

Yeah I should color before cloning, it’s faster.

afbeelding

2 Likes