How to :Destroy() hats in Player?
I've been wondering how to get rid of all the hats that are descendants of a player that touches a brick. Here's an example block of code that is inside the brick:
1 | local function changePlayer(Part) |
2 | if hum = Part.Parent:FindFirstChild( "Humanoid" ) then |
6 | script.Parent.Touched:connect(changePlayer) |
In the "--A block of code that removes all hats--" part, I was thinking of doing this
1 | local children = Part.Parent:GetChildren() |
2 | for _, child in ipairs (children) do |
Will this work?
I'm really struggling for a simple way to do this. Thanks!