HI devs when i try and add a acessory via a part to the player i get this error AddAcessory failed: Accessory is already being worn by another character
can anyone help
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
print("run")
debounce = false
local old = hit.Parent:FindFirstChildWhichIsA("Accessory")
if old then
old:Destroy()
end
local h = game:GetService("ReplicatedStorage").Hat:Clone()--put hat name here
h.Name = "Hat"
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new (-0, -0, -1)
h.AttachmentPos = Vector3.new(0, 0.092, 0)
h.AttachmentRight = Vector3.new (1, 0, 0)
h.AttachmentUp = Vector3.new (0, 1, 0)
hit.Parent.Humanoid:AddAccessory(h)
print("done")
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
As in, it doesn’t move from its original pos set in ReplicatedStorage? Maybe instead of doing
local h = game:GetService("ReplicatedStorage").Hat:Clone()--put hat name here
h.Name = "Hat"
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new (-0, -0, -1)
h.AttachmentPos = Vector3.new(0, 0.092, 0)
h.AttachmentRight = Vector3.new (1, 0, 0)
h.AttachmentUp = Vector3.new (0, 1, 0)
hit.Parent.Humanoid:AddAccessory(h)
Just do
local h = game:GetService("ReplicatedStorage").Hat:Clone()--put hat name here
hit.Parent.Humanoid:AddAccessory(h)
And see if that fixes anything? If not, it may be something wrong with how the hat is set up, does it have the usual things (OriginalSize NumberValue, HatAttachment, etc) inside of it? Is the part in the accessory called “Handle”?
If you don’t have the usual things in the accessory’s Handle part, do a play test, go into one of your hat accessories form the explorer, copy everything i nthe Handle part and past ethem to your Hat’s handle part