So I have a script:
01 | game.Players.PlayerAdded:connect( function (plr) |
02 | plr.CharacterAdded:connect( function (char) |
03 | if char:FindFirstChild( 'Accessory' ) then |
04 | local gethats = char:GetChildren() |
05 | for i,v in pairs (gethats) do |
06 | if v.ClassName = = "Accessory" then |
07 | v:Destroy() |
08 | end |
09 | end |
10 | end |
11 | end ) |
12 | end ) |
It doesn't do anything and I don't get any errors either.
1 | game:GetService( "Players" ).PlayerAdded:Connect( function (plr) |
2 | plr.CharacterAdded:Connect( function (char) |
3 | char:WaitForChild( "Humanoid" ):RemoveAccessories() |
4 | end ) |
5 | end ) |
RemoveAccessories
method does this for us. On a side note, switch to :Connect()
, as :connect()
is deprecated and should not be used in new work.