Hair Customization for a character customization system (HELP NEEDED)

Hello, I am making a character customization system and I’ve ran into an issue with hair.

The goal is that the player can select the hair with gui (I have the hairs in a folder in replicated storage)
image

The mechanics of the gui (as in number) work fine, but they don’t actually switch hair on the character because I am unsure how to make it properly

However, unlike faces, which I fixed by putting their texture id into a table, I don’t think I can put hair accessories in tables.
If I try to do GetChildren(), the order will be somewhat buggy and will be different each time (that was the first thing I tried)

If you want me to provide code, ask me and I will.

You don’t need to put the hair in storage, just hold their asset ID in a table like you do with the faces.

1 Like

Ah, and just use insert service to add it to the character?

If you have a specific order you want these hairs to be in, you can manually create that yourself using an array:

local Hairs = {ReplicatedStorage.Hair1, ReplicatedStorage.Hair2}

You can then use the number to index the Hairs table:

-- Assume num and player are already defined 
local Hair = Hairs[num]
Hair:Clone().Parent = player.Character

Another thing: On the documentation, it specified :GetChildren() returns an array whose indexes are sorted in the order in which the Parent property of that instance was set to the object. An example being Part2’s parent is set to an object before Part1 — meaning Part2 would be the array’s first index.

2 Likes

Thank you! That makes a lot of sense and I’m not sure what I was thinking.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.