Forbidden error while trying to re-equip accessories

Hello! There appears to be an issue while using :GetHumanoidDescriptionFromUserId on NPC’s. Quite often, the accessories that are loaded are incorrectly positioned which makes the player look odd. This is more common with UGC items, but does also happen with Roblox items, as demonstrated below.

From this screenshot, you can see that the bunny tail item is on the face, rather than the lower back. Another thing is the glasses, there seems to be a “loose hair” at the top of the head, but it’s actually a part of the glasses.
Screen Shot 2020-05-06 at 6.55.36 PM

I’m not sure where to go from here, any suggestions?

Edit: I tried using an event to find when the NPC was properly loaded, and then re-equip the accessories, however I got error 403 I think, it was the forbidden error

Here's my script:
function loadNPC()

for i,v in pairs(script.Parent:GetChildren()) do
	print("loop")
	if v.ClassName == "Accessory" then
		print("accessory")
	
		local accessoryHandle = v.Handle
		
		local accessoryID = accessoryHandle:FindFirstChildOfClass("SpecialMesh").MeshId
		
		local accessoryID = tonumber(accessoryID:sub(14))
		
		local IS = game:GetService("InsertService")
	
		print(v.Name)
	
		local accessory = IS:LoadAsset(accessoryID)

		script.Parent.Humanoid:AddAccessory(accessory)
	end
end

end

game.ReplicatedStorage.LoadNPC.Event:Connect(loadNPC)

That may be happening if you’re using R6, as accessories can load but not know where to attach to. Switching your NPCs to R15 might fix the issue.

1 Like

Not sure if it’s relevant to AddAccessory() but LoadAsset returns a model containing the asset, not the asset itself. Try calling AddAccessory with the Accessory instance instead. You can do this by finding the first child of the model

script.Parent.Humanoid:AddAccessory(accessory:GetChildren()[1])
1 Like

Wouldn’t that return an error though? I tried equipping the already equipped accessory, but the output returned something like Unable to add accessory as it's already equipped to a different character. I’ll try it though, thanks!

Yeah, it returned an error.
I ended up moving it to a folder in workspace and then re-adding it to no avail.

It did technically re-equip the accessory, however the positioning was wrong.

Script
function loadNPC()

for i,v in pairs(script.Parent:GetChildren()) do
print("loop")
	if v.ClassName == "Accessory" then
		print("accessory")

		print(v.Name)
	
		v.Parent = game.Workspace.Accessories
		
		script.Parent.Humanoid:AddAccessory(v)
	end
end
end

game.ReplicatedStorage.LoadNPC.Event:Connect(loadNPC)