Hats not attaching in Viewport frame

I’m making a dialouge system that shows the head of the player with an animation and talking face.
everything seems to work fine except the fact the hats wont attach correctly and when they do they’re stuck and dont move with the head. Need help!

I’m using a WorldModel for the viewport.

code:

function UpdateCharacter3(character)
	for i, v in pairs(script.Parent.PlayerImage.Icon.WorldModel:GetDescendants()) do
		if v:IsA("Accessory") or v:IsA("Hat") or v:IsA("BodyColors") then
			v:Destroy()
		end
	
	end
	for i, v in pairs(character:GetChildren()) do
		if v:IsA("Accessory") or v:IsA("Hat") or v:IsA("BodyColors") then
			local new = v:Clone()
			new.Parent = script.Parent.PlayerImage.Icon.WorldModel
		end
	end
	wait()
	script.Parent.PlayerImage.Icon.CurrentCamera = camera
	camera.CFrame = script.Parent.PlayerImage.Icon.WorldModel.Head.CFrame * CFrame.new(0, 0.2, -2) * CFrame.Angles(0, math.rad(180), 0)
end

How it looks : https://gyazo.com/6c943bb410fe2f40383deac6872ee641

2 Likes

I don’t have that much experience with this as I’ve only done this once. Copying an avatar directly into WorldSpace seemed to work perfectly fine. But by the looks of it, it seems that you’re parenting the accessories into WorldModel rather than the avatar. For things like accessories and body colors to work, they need to be parented into a character model that has a Head and a Humanoid (might also require a HumanoidRootPart, but I haven’t tested in detail).

2 Likes

My apologies for having to correct you, but the proper word for the manager of a school is “Principal”. “Principle” is a fundamental truth that serves as the foundation for a system of belief for a chain of reasoning.

2 Likes