Attaching player's accessories to a dummy doesn't work as expected

Okay so, recently I’ve been trying to change the player’s character to a dummy associated with the player’s accessories, but it doesn’t even seem to work as expected. The accessories welds weirdly, the “AccessoryWeld” even deletes itself that I had to create my own, which didn’t work aswell. yes I tried addaccessory(). It doesn’t work that way too. I’m really unsure what to do. Help is appreciated!
This is the script:

	local oldModel = p.Character
		local newModel = model:Clone()
		local oldCFrame = oldModel:GetPrimaryPartCFrame()
		newModel.Name = p.Character.Name
		for i, v in pairs(p.Character:GetChildren()) do
			if v:IsA("Accessory") then
				local dummy = newModel
				local Hat = v:Clone()
				Hat.Parent = dummy
				local Weld = Instance.new("Weld",Hat.Handle)
				Weld.Name="AccessoryWeld"
				Weld.Parent = Hat.Handle
				Weld.Part0 = Hat.Handle
				Weld.Part1 = dummy[v.Handle.AccessoryWeld.Part1.Name]
			end
		end
		
		p.Character = newModel
		newModel.Parent = workspace -- this follows current character loading behavior
		newModel:SetPrimaryPartCFrame(oldCFrame)
		oldModel:Destroy()
		dontrepeat = Instance.new("Attachment")
		dontrepeat.Name = model.Name
		dontrepeat.Parent = newModel.HumanoidRootPart

This is the odd behavior:
image

Dummy.Humanoid:AddAccessory(AccessoryInstance)

I have found my error, apparently you should also use a player rig and not a random rig. What I did was copy my avatar’s rig and deleting hats from it then made it a new rig.

1 Like