Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Accessory Being Worn By A Character When It's Not Worn By Anything?

This error/warning just doesn't make sense

AddAcessory failed: Accessory is already being worn by another character.

No. The accessory is freshly cloned and not being worn by anything.

game.Players.PlayerAdded:Connect(function(plr)
	local clone = game.ReplicatedStorage.Backpack:Clone()
	local char = plr.CharacterAdded:Wait()
	clone.Parent = char
	local hum = char:WaitForChild("Humanoid")
	hum:AddAccessory(clone)
	end)

2 answers

Try this.

Code:

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAppearanceLoaded:connect(function(char)
        local hum = char:WaitForChild("Humanoid")
        hum:AddAccessory(game.ReplicatedStorage.Backpack) 
        hum.Died:connect(function()
            char:FindFirstChild("Backpack").Parent = game.ReplicatedStorage
        end)
    end)
end)

Setting the parent of the accessory automatically adds it to the humanoid technically. So, when you call :AddAccessory, it has already been put inside the player's character model. Instead, do this:

game.Players.PlayerAdded:Connect(function(plr)
    local clone = game.ReplicatedStorage.Backpack:Clone()
    local char = plr.CharacterAdded:Wait()
    local hum = char:WaitForChild("Humanoid")
    hum:AddAccessory(clone)
end)

the only thing changed is the .Parent line is removed.

This discussion is preserved as it was. New answers, comments, and votes are closed.