Attachments don't place correctly when loading a custom npc

wait(5)
local Model = script.Parent

local function resetModel()
	for i,v in pairs(Model:GetChildren()) do
		if v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') or v:IsA('ShirtGraphic') then
			v:Destroy()
		end
	end
	if Model.Head:findFirstChild('Mesh') then
		Model.Head.Mesh:Destroy()
	end
end

local function updateModel()
	local UserId = Model.UserId.Value
	local AppModel = game.Players:GetCharacterAppearanceAsync(UserId)
	for i,v in pairs(AppModel:GetChildren()) do
		if v:IsA('Decal') then
			Model.Head.face.Texture = v.Texture
		elseif v:IsA('CharacterMesh') or v:IsA('ShirtGraphic') then
			v.Parent = Model
		elseif v:IsA('Accessory') then
			v.Parent = Model
			v.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * v.AttachmentPoint:inverse()
		end
	end
	if not Model.Head:FindFirstChild('Mesh') then
		local m = Instance.new('SpecialMesh', Model.Head)
		m.MeshType = Enum.MeshType.Head
		m.Scale = Vector3.new(1.25, 1.25, 1.25)
	end
end

updateModel()

I want my NPC to have a player’s accessories, face etc. The problem is sometimes the accessories aren’t placed correctly. image
This script is from a tutorial and I don’t know much about accessory placement. How do I fix the positioning?

https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory

Use this to add an Accessory instance to a Humanoid instance of a player’s character.

Nvm, I found a solution. My character didn’t have any attachments so they couldn’t place correctly. I added them and also included Limited_Unique’s suggestion to use AddAccessory.