You're using the wrong events. The hats probably haven't even loaded yet.
local plr = game.Players.LocalPlayer
local chr = plr.CharacterAppearanceLoaded:wait()
for i,v in next, chr:GetChildren() do
if v:IsA("Hat") then
v:Destroy()
end
end
#code R+ | local RAP = "R$436,826"; local robux = "R$8,566" |