Humanoid:AddAccessory() doesn't position accessories correctly

I’ve seen many topics about this issue but none of them had a solution.

I’m loading accessories into the game using InsertService:LoadAsset() and Humanoid:AddAccessory() to add them to the character. I expect the latter to also correctly position the accessories as I believe my rig fulfills all requirements.

From the docs:

This method attaches the specified Accessory to the humanoid’s parent.

When this method is called, an Accessory is attached to the character by searching for an Attachment in the humanoid’s parent that shares the same name as an Attachment in the accessory’s Handle Part. If one is found, the Handle part will be connected to the parent of the Attachment using a Weld, and the weld will be configured so the Attachments occupy the same space.

If the required Attachment can not be found, then the Accessory will remain parented to the humanoid’s parent but it will be unattached.

In particular: “When this method is called, an Accessory is attached to the character by searching for an Attachment in the humanoid’s parent that shares the same name as an Attachment in the accessory’s Handle Part.”

Both my rig’s head and accessory have an Attachment named “HairAttachment”, yet the hair accessory is not correctly positioned.

In case it matters, my rig is inside a ViewportFrame.

1 Like

had same issue with my auto updating statue i had, here is what fixed it for me had to use a different method…

	task.wait(1)
	local AppModel = game.Players:GetHumanoidDescriptionFromUserId(userId)
	Model.Name = game.Players:GetNameFromUserIdAsync(userId)

	Model.Humanoid:ApplyDescription(AppModel)
end

I can’t use ApplyDescription because I’m not applying another character’s HumanoidDescription but rather adding single dynamically fetched accessories.

i know same with me too lol that fixes it though it works same way just has accessories fixed.

my bad miss read, deleted my suggestion afterwards though since you fixed it

Due to you saying it’s in viewport, I understand that it’s running in local script. The problem is that accessories don’t work on client, you have to attach them manually

I’m guessing it has to do with this:

Typically, accessory welds are created on the server, but they can be created on the client under certain circumstances. In these situations, client-sided calls to AddAccessory() may not always produce the desired behavior and you can use BuildRigFromAttachments() to force the expected weld creation.

1 Like

I recommend using this

1 Like

As @Sarlex0 and the docs say, positioning will fail on the client. To fix this it’s enough to add Humanoid:BuildRigFromAttachments() after Humanoid:AddAccessory().

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.