I need help with hair for my character creation

Im trying to make a custom character creation but when i dont know how i need to change the hair since it doesnt have a template like pantstemplate

my script

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera

repeat wait() until cam.CameraSubject ~= nil

cam.CameraType = Enum.CameraType.Scriptable


cam.CFrame = workspace.CameraLocation.CFrame

char:MoveTo(workspace.CSpawn.Position)

--shirts

local allShirts = game.ReplicatedStorage:WaitForChild("Customization"):WaitForChild("Shirts"):GetChildren()

char:WaitForChild("Shirt").ShirtTemplate = allShirts[1].ShirtTemplate
script.Parent.Shirt.Current.Value = 1

script.Parent.Shirt.Next.MouseButton1Click:Connect(function()
	script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value + 1
	if script.Parent.Shirt.Current.Value > #allShirts then 
		script.Parent.Shirt.Current.Value = 1
	end
	
	char:WaitForChild("Shirt").ShirtTemplate = allShirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)

script.Parent.Shirt.Previous.MouseButton1Click:Connect(function()
	script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value - 1
	if script.Parent.Shirt.Current.Value < 1 then 
		script.Parent.Shirt.Current.Value = #allShirts
	end

	char:WaitForChild("Shirt").ShirtTemplate = allShirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)
--pants

local allShirts = game.ReplicatedStorage:WaitForChild("Customization"):WaitForChild("Pants"):GetChildren()

char:WaitForChild("Pants").PantsTemplate = allShirts[1].PantsTemplate
script.Parent.Pants.Current.Value = 1

script.Parent.Pants.Next.MouseButton1Click:Connect(function()
	script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value + 1
	if script.Parent.Pants.Current.Value > #allShirts then 
		script.Parent.Pants.Current.Value = 1
	end

	char:WaitForChild("Pants").PantsTemplate = allShirts[script.Parent.Pants.Current.Value].PantsTemplate
end)

script.Parent.Pants.Previous.MouseButton1Click:Connect(function()
	script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value - 1
	if script.Parent.Pants.Current.Value < 1 then 
		script.Parent.Pants.Current.Value = #allShirts
	end

	char:WaitForChild("Pants").PantsTemplate = allShirts[script.Parent.Pants.Current.Value].PantsTemplate
end)

if you are using Accessories for the hair, there is a Special Function for the Humanoid:AddAccessory()
https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory

1 Like