function giveHair(character, item, class, itemClass)
local h = Instance.new("Accessory")
local p = Instance.new("Part")
local a = Instance.new("Attachment")
local pos = class:FindFirstChild(itemClass):FindFirstChild("Value")
a.Name = "HairAttachment"
a.Position = pos.Value
a.Parent = p
h.Name = tostring(item)
p.Parent = h
p.Position = character:FindFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(0,-0.25,0)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
--Clones mesh
class:FindFirstChild(itemClass):FindFirstChild(item):Clone().Parent = p
humanoid:AddAccessory(h)
end
When I add the accessory to the character, it positions it sideways and when the character moves, the hair just falls down. I tried using the HairAttachment, but that didn't help me at all. Parenting the hair to the character doesn't even weld either. I've searched the Roblox Developer Forums, and the answers from previous posts didn't work as well. I don't see a problem with my code since I tested this function on another game, and it worked perfectly fine. I'm using a starter R6 character that can't move or jump for the purposes of customizing.

2 comments
Have you tried using a weld?
No, because the HairAttachment is supposed to already add a weld, but it doesn't.