Hair Is Spawned Off Mans Head

Hey guys,
I am trying to make a “select your own hair” system. The hair imports, but not on the head.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local hairstylesFolder = ReplicatedStorage:WaitForChild("hairsyles")
local frame = script.Parent:WaitForChild("ScrollingFrame")

local rig = workspace:WaitForChild("CREATEPLAYER"):WaitForChild("Rig")
local leftbtn = frame.Frame:WaitForChild("left")
local rightbtn = frame.Frame:WaitForChild("right")
local selectbtn = frame.Frame:WaitForChild("select") 
local hairstyles = {}
for _, item in ipairs(hairstylesFolder:GetChildren()) do
	if item:IsA("Accessory") then
		table.insert(hairstyles, item)
	end
end


local function clearHair()
	for _, child in ipairs(rig:GetChildren()) do
		if child:IsA("Accessory") then
			child:Destroy()
		end
	end
end


local currentIndex = 1

leftbtn.MouseButton1Click:Connect(function()
	currentIndex -= 1
	if currentIndex < 1 then
		currentIndex = #hairstyles
	end
end)

rightbtn.MouseButton1Click:Connect(function()
	currentIndex += 1
	if currentIndex > #hairstyles then
		currentIndex = 1
	end
end)


selectbtn.MouseButton1Click:Connect(function()
	clearHair()
	local template = hairstyles[currentIndex]
	if template then
		local hair = template:Clone()
		
		hair.Parent = rig
	end
end)

Show the accessories, it’s definitely an issue with the accessories themselves and not the script from what I’m seeing. Does the accessory have it’s Hat/HairAttachment? AccessoryWeld?


Appreciate the reply. This is the accessory. Looks like the attachment is there, the only way it goes on the head is if I select then unselect it.

Thanks for the reply, there is a hair attachment, could the problem be the script being a local script?

Hey Finbot_YT,

…Well, yes, that’s actually a problem on its own. All of it operating under a LocalScript means that only the client (the player selecting their own hair) can see it. Since it’s not replicated to the server, other players cannot see it.

It should be the server handling placing the accessories.

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