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

Hat remover script not removing hats why?

Asked by
MHaven1 159
8 years ago
game.Players.PlayerAdded:connect(function(plr)
    for i,v in pairs(plr.Character:GetChildren())do
        if v.ClassName == "Hat" or v.ClassName == "Accountrement" then
            v:Destroy()
        end
    end
end)

i am trying to make a script that deletes all the hat player has when he joins the game but this script will not work please help.

1 answer

Log in to vote
2
Answered by 8 years ago
Edited 8 years ago

The hat class has been replaced with the Accessory class. You also spelled Accoutrement wrong.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(character)
        for i,v in pairs(character:GetChildren())do
            if v.ClassName == "Accoutrement" then
                v:Destroy()
            end
        end
    end)
end)
Ad

Answer this question