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

How to Remove Accessories properly?

Asked by 5 years ago

Hello my script in removing accessories in a character doesn't work. The error doesn't pop-up in the output.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        repeat wait()until character
        character.Humanoid:RemoveAccessories()
    end)
end)
0
why are you using a repeat loop if you have the CharacterAdded event User#23365 30 — 5y
0
Oh i tested to see if it works if i put a loop on but it doesn't. Bravelol2474 1 — 5y

1 answer

Log in to vote
0
Answered by
Norbunny 555 Moderation Voter
5 years ago

I personally do it this way, not sure if there's any other way.

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:connect(function(char)

        for _,v in pairs(char:GetChildren()) do
            if v.ClassName == 'Accessory' then
                v:Destroy()
            end
        end
    end)
end)
Ad

Answer this question