function onTouched(hit)
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") and d.Name ~= "Helmet" then
d[i]:remove()
end
end
end
script.Parent.Touched:connect(onTouched)
I want this is remove the players hats, EXCEPT for a hat named "Helmet" There is no error in output, it just removes everyones hats. I am trying to make a war game, and I need so when the players 'join' or touch the button they lose their real hats, and are left with a helmet that they are given.
