How do I remove hats using HumanoidDescription?

See title. Trying to create an avatar screen and the way it works is through HumanoidDescription, directly modifying the humanoid doesn’t work for the setup.

If you are using a custom character, you can utilize the Humanoid.

Humanoid has some functions such as :AddAccessory() or :RemoveAccessories. Since you are specifically looking to remove hats, do the following;

for Index,Accessory in pairs(Character:GetChildren()) do
    if Accessory:IsA("Accessory") and Accessory.AccessoryType == Enum.AccessoryType.Hat then
        Accessory:Destroy()
    end
end

Just call RemoveAccessories() on the character’s humanoid.

https://developer.roblox.com/en-us/api-reference/function/Humanoid/RemoveAccessories