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

The script I made to delete hats but keep hairs isnt working and I dont know how?

Asked by
608b 4
4 years ago
game.Workspace.ChildAdded:Connect(function(player)
    if player:FindFirstChild('Humanoid') then
        for i,v in pairs(player:GetChildren()) do
            if v:IsA("Accessory") then
                for i,e in pairs(v:GetChildren()) do
                    if e.className == ("Attachment") then
                        if e.Name ~= ("HairAttachment") then
                            e.Parent:Destroy()
                        elseif
                            e.className == ("Attachment") then
                                if e.Name == ("HairAttachment") then
                                print('Hair Found')
                            end
                        end
                    end
                end
            end
        end
    end
end)

For some reason, It shows no errors but it doesn't work.

Brief explanation of what I want the script to do:

I want to keep the hair but delete the hats.

Answer this question