So I have a script:
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) if char:FindFirstChild('Accessory') then local gethats = char:GetChildren() for i,v in pairs(gethats) do if v.ClassName == "Accessory" then v:Destroy() end end end end) end)
It doesn't do anything and I don't get any errors either.
game:GetService("Players").PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) char:WaitForChild("Humanoid"):RemoveAccessories() end) 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.