I recently made a script that would delete any hats/tools that fall to make less lag but now it seems to be broken
The script
while true do wait(5) L = game.Workspace:GetParent() for i = 1, #L do if L[i].className == "Hat" or L[i].className == "Tool" then L[i]:Remove() wait(1) end end end
For tools, I would recommend setting CanBeDropped to false.
For hats, there's this example script on the wiki which prevents them from being dropped.
The problem with your script is that you write GetParent instead of GetChildren, but a problem beyond that is efficiency; a more efficient method for clearing hats would be to erase them once they're dropped.
workspace.ChildAdded:connect(function(hat) if hat:IsA("Accoutrement")then hat:Destroy() end end)