Hat removal script

image hi, just wondering why this script doesn’t work?

1 Like

What about it doesn’t work? Does it error? Does it run but not function? What are the results of it if it does run?

1 Like

No errors at all, the head transparency works, however the hat removal doesn’t

Try using :GetDescendants() instead of :GetChildren(). There might be some accessories in body parts.

Change CharacterAdded to CharacterAppearanceLoaded

6 Likes

I have tried it out, however it still does not work

1 Like

it worked for me, did you spell everything correctly? What did the output say?

there are no errors, and the output doesnt say anything

Did you try changing plr.CharacterAdded to plr.CharacterAppearanceLoaded?

1 Like

yeah, however im still not sure why it isnt working

Accessories are all in the character I believe, I have a shoulder accessory that still appears under character - it wouldn’t make sense if only some were in character while others are stored elsewhere…

1 Like

try printing something in the function and see if it prints.

1 Like

my bad, turns out a made a stupid little mistake lol. I accidentally put head:GetDescendants() instead of char:GetDescendants()

1 Like

Make sure to mark my reply as the solution just in case anyone else has the same question. Also, there is no need for GetDescendants, GetChildren will work fine as Accessories are only parented to the character model

3 Likes

Is this in a local script? Just making sure because I’ve scripted something in a local script instead of a server script by accident before. xd

Also, after some testing I got the same thing where it didn’t clear the accessories but I added a Player.CharacterAppearanceLoaded function event before the for i,v *bla bla bla* and it worked. :slight_smile:

I have resolved it, the problem was because I used ‘head’ instead of the character. and obviously the accessories are not in the head lol