In my game we have little blocks that you click on to change hair color. For some context, we use this WigGiver and when you apply a hairstyle it's basically applies as an accessory called "Hat" onto the player. So here's the script we use now (in this case, it turns the hair color to a light blue):
local function onClicked(playerWhoClicked)
playerWhoClicked.Character.Hat.Part.Mesh.VertexColor = Vector3.new(0.05, 0.412, 0.67)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
As you guys can probably see, it changes the vertex color of a mesh contained within a part called "Part". However, some hairstyles we use have multiple parts called "Part" in them so when we use the hair colorer, it only changes one part of the hairstyle.
What I would need is a script that changes the mesh color of all parts called "Part" within the Hat. I tried using some scripts I found online but I got completely lost and couldn't get them to work.

1 comment
What you can do is loop "hat" and check if the name is "Part", then, you change the Part.Mesh.VertexColor