Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a characters hat invisible?

Asked by 8 years ago

Ok, so, when I go to script I can make the face be removed by a simple game.Players.LocalPlayer.Character.Head.face.Texture = 0 but I want to know how you would remove the hats of the player? I know it has something to do with manipulating the handle but I don't know how.

1 answer

Log in to vote
1
Answered by 8 years ago

First, you have to consider the fact that ROBLOXians may have more than one hat. That said, hats are basically Hat objects placed in the character model. Going through all children of the character, filtering out the hats and setting their Handle children's transparency to 0 would be a good way to do this:

This code assumes that the player's name is ROBLOXian

character = game.Players.ROBLOXian.Character;
for k, v in pairs(character:GetChildren()) do
    if v.ClassName == 'Hat' then
        v.Handle.Transparency = 1;  -- Handle is a Part object
    end;
end;
Ad

Answer this question