I am trying to make a script that turns the player invisible but the accessories will not go away.
I have tried multiple things but 90% of the time it won't work and 10% it will work.
wait(0.1)
for k, v2 in pairs(char:GetDescendants()) do
if v2:IsA("BasePart") or v2:IsA("Decal") then
v2.Transparency = 1
end
end
for i,v in pairs(char:GetChildren()) do
if v.ClassName == "Accessory" then
v:Destroy()
print("Destroyed: "..v.Name)
end
end
wait(0.1)
for i,v in pairs(char:GetChildren()) do
if v.ClassName == "Hat" then
v:Destroy()
end
end
wait(0.1)
it won't even output anything.

1 comment
I ran your code myself as it looked like it should work and it actually worked for me. This means the only thing that could have gone wrong is did you define char successfully?