Accessories refuse to be worn?

Greetings!
I’m trying to make an accessory be worn cliently into an NPC
However, whenever the script calls for the humanoid to wear the accessory, it doesn’t appear on the NPC even though on the explorer it is parented there.
The accessory properties are correct, the accessory just doesn’t appear somehow.
↓↓↓↓The partial code and the video are below ↓↓↓↓

CloneBut.MouseButton1Click:Connect(function() --Event
	if FindChild(WornHats,CloneBut.Name) then --Check if hat is worn or not
		local CurrentHats = {}
		for _,H in pairs(LockerNPC.Humanoid:GetAccessories()) do --Get hats that aren't the chosen hat
			if H.Name ~= CloneBut.Name then
				table.insert(CurrentHats,H:Clone())
			end
		end
		LockerNPC.Humanoid:RemoveAccessories()
		for _,H in pairs(CurrentHats) do --Add the other hats on
			LockerNPC.Humanoid:AddAccessory(H) 
		end
		for i,vv in pairs(WornHats) do --Remove the hat from the table
			if vv["Name"] == CloneBut.Text then
				table.remove(WornHats,i)
			end
		end	

		CloneBut.TextColor3 = Color3.new(255,255,255)
	else --Hat isn't worn
		CloneBut.TextColor3 = Color3.new(0.333333, 1, 0)
		local H = Hat:Clone()
		LockerNPC.Humanoid:AddAccessory(H) --Wears hat
		table.insert(WornHats,{Name = CloneBut.Text,Parent = ButonMenu.Folder}) --Adds the hat into the table
	end
end)

1 Like

If you locally parent a hat, the weld doesnt get applied.
There is a script that does this for localscripts somewhere, you can try to find it

EDIT: This: Humanoid:AddAccessory does not work with FE from a LocalScript - #4 by TheGamer101

2 Likes

Thank you and very much appreciated! Now it works as intended:

2 Likes