AddAccessory Local Script

I’m trying to create a character creation script which locally clones a blank character model from replicated storage, then tries to call AddAccessory on it. When I try this code server-side, it properly attaches the accessory. When I call it locally however, it parents the hair to the character but refuses to attach it, leaving the hair in its original position.

Does anyone know a way to make it work locally, or another way to attach accessories locally?

Here’s the code:

function SetHair(hairId)
	local hairModel = hairModels:FindFirstChild(hairId)

        if hairModel == nil then
            warn("Unable to find hair model for ID "..hairId)

	hairModel = hairModel:Clone()
        hairModel.Parent = workspace

1 Like

What is the charModel’s parent when AddAccessory() is called on/through it?

The attachment, already assembled on this “template character”, is not placed on? Have you tried calling when the Attachment is placed on the character already?

I would very much like to know the same thing. I believe you cannot use AddAccessory on a character in nil or some other form of storage.

To clarify, the character’s parent is workspace.

The accessory isn’t already attached to the character when I call AddAccessory. I’m calling AddAccessory to attach the accessory to the character.

It is intended behavior for a LocalScript to not “attach” accessories to the character locally.

An admin generously provided code that allows a LocalScript to properly attach accessories to a character.