Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to attach an accessory to a NPC?

Asked by
Roytt 64
6 years ago

I made this to search for a way to attach accessories but it does not work, the accessory just falls to the ground.

for i,v in pairs(game.ReplicatedStorage.Hats:GetChildren()) do
        print(v.Name)
        local h = c:FindFirstChildOfClass("Accessory")
        if h then h:Destroy() end
        local hc = v:Clone()
        local att = hc.Handle:FindFirstChildOfClass("Attachment")



        att.Position = c.Head.Position 
        hc.AttachmentPos = c.Head.Position
        hc.AttachmentPoint = c.Head.CFrame
        hc.Parent = c
        c.Humanoid:AddAccessory(hc)
        wait(3)
    end

I know there are similar questions, but none of them solve my issue or provide an insightful answer.

1
You do not need to setup the accessory, AddAccessory will use the attachment system to connect the attachment to the player. User#5423 17 — 6y

Answer this question