AddAccessory is a function that attaches the specified
Accessory to the
How are Accessories attached to Humanoids?
Accessory is parented to the
Humanoid|Humanoid's parent and then attached.
Accessory is attached to the character by searching for an
Attachment in the
Humanoid|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. This weld will be configured so the
Attachment|Attachments occupy the same space.
If the required
Attachment can not be found, then the
Accessory will remain parented to the
Humanoid|Humanoid's parent but it will be unattached.
[Humanoid] AddAccessory Example
This script generates the “Clockwork’s Shades” Accessory from scratch, and then attaches it to the player’s character using
Humanoid.AddAccessory You should paste this code into a regular script, and then parent it inside of the
local playerModel = script.Parent local humanoid = playerModel:WaitForChild("Humanoid") -- Create the Accessory. local clockworksShades = Instance.new("Accessory") clockworksShades.Name = "ClockworksShades" local handle = Instance.new("Part") handle.Name = "Handle" handle.Size = Vector3.new(1,1.6,1) handle.Parent = clockworksShades local faceFrontAttachment = Instance.new("Attachment") faceFrontAttachment.Name = "FaceFrontAttachment" faceFrontAttachment.Position = Vector3.new(0,-0.24,-0.45) faceFrontAttachment.Parent = handle local mesh = Instance.new("SpecialMesh") mesh.Name = "Mesh" mesh.Scale = Vector3.new(1,1.3,1) mesh.MeshId = "rbxassetid://1577360" mesh.TextureId = "rbxassetid://1577349" mesh.Parent = handle -- Attach the Accessory to the humanoid. humanoid:AddAccessory(clockworksShades)