Ok so I was making this hair customizer/giver (you probably saw in my recent posts) and I've managed to make it work but for some reason it keeps teleporting my character to the object and not the hair onto my characters head

https://streamable.com/2982r9 here's a video

here's my code

local hair = script.Parent
hair.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local head = hit.Parent.Head
		local NewHair = hair:Clone()
		NewHair.Parent = head
		-------------------------------------
		NewHair.Position = head.Position
		local weld = Instance.new("Weld")
		weld.Parent = NewHair
		weld.Part0 = head
		weld.Part1 = NewHair
		weld.C0 = CFrame.new(0,1,0)
		weld.C1 = head.HairAttachment.CFrame
		
		weld.Parent.Anchored = false
		
	end
	
end)

I set the anchored as false but it looks like its still anchored? and the CanCollide for the hair model is off too (its a part that has a mesh by the way)

6 comments

0

Oh also it says something like HairAttachment is not a valid member of part even though HairAttachment is found on the character head?

0

Make sure that the part is not joined with any other surfaces, as that can cause a reaction like the one you described. Also, I tested the script and did not receive an error about the HairAttachment, so that might be the result of something else.

0

What do you mean by any other surfaces? like if its in a group? because it is in a group

0

hang on heres my discord Randy Butternubs #7224

0

I just tested it, and no. It being grouped does not affect the script. What I meant is that it shouldn't be physically making contact with any other parts. Just drag it upwards a little bit with the move tool and it should fix your problem.

0

You just gave me immense relief thankyou so much