Hair Color Changer, Having Problems

So essentially for my game, there’s a character customization GUI. The player has the option to select different hairs for their avatar. Upon joining, the player has a folder created inside their head called “Hair”. In this folder the MeshPart (titled Hair1, Hair2, etc.) is placed in the folder and added to the avatar. This works flawlessly, the problem I encountered is with the hair color changing. Upon clicking on the color, it fires an event titled “HairColorEvent(Number)” which corresponds to a small sequence in the central script to change the color of the hair.

This is where I ran into some problems.

The sequence is not changing the color of the player’s hair. This is the sequence:

    local char = plr.Character

    if char:findFirstChild("Humanoid") then
	    local HairPart = char.Head.Hair:GetChildren()
	    HairPart[1].Color3 =, 133, 65)

This is what the folder looks like:
I assumed when I put Head.Hair:GetChildren() it would retrieve the MeshPart in the folder, but it is not doing so.

Any help would be appreciated, thank you.


I think what your problem is, in :FindFirstChild, you put :findFirstChild. Try capitalise the F in Find.

1 Like

The instance GetChildren grabs every child of that parent, are you trying to grab everything in the folder?

Here is an article for more info: Instance | Documentation - Roblox Creator Hub

1 Like

Are you getting any error? Because mesh parts dont have Color3 Property. Only Color.


The color property of BaseParts is named “Color”, not “Color3”. Also Color3s are constructed from numbers between 0 and 1.

The code should look like this:

local HairPart = char.Head.Hair:GetChildren()
for _, part in pairs(HairPart) do
    if (part:IsA("BasePart")) then
        part.Color = Color3.fromRGB(218, 133, 65)

Yes, there should only be one part in that folder at all times anyway since when you select a new hair it clears all existing children before adding a new one.

1 Like

What does BasePart mean? Should it be “MeshPart” instead?

1 Like

BasePart is an abstract class that encompasses all types of parts. That line is meant to ensure that the script won’t try to change the Color of any objects that don’t have a Color property.

However, you mentioned in a different reply that each hair will only contain one mesh part. If that’s the case then you don’t need to call GetChildren() at all, and you can just index the meshpart by name.

1 Like

Your code worked, thank you so much. I replaced BasePart with MeshPart and it worked. Also, finding the MeshParts by name would be difficult since each hair would have a different name. Whenever you pick a new hair, it changes the name and mesh. i.e. Hair1, Hair2, Hair3. If that were the case I’d have to script in each color for each hair which would be too cumbersome.

1 Like