Hiding Humanoid Names
Hiding Humanoid Names
By default, all
Humanoid models have a GUI floating over their head that shows how much health they currently have, and what their name is. This can be problematic in cases where you don’t want players to be able to see Humanoid models.
In order to get around this you have a two options available:
Player/NameDisplayDistanceproperties of a player. This will enable you to hide the player’s name and health if you set both to zero when they join the game. However, this will only work for a player’s character not non-player characters.
- Setting the transparency of the Humanoid model’s head to 1. This will make both the GUI shown above and the Humanoid’s head invisible, and should only be used when the Humanoid belongs to a non-player character.
Solution for a missing head
If you decided to set the transparency of the Humanoid model’s head to one may get an NPC/player running around without a head. In order to fix this problem, you will have to create a ‘fake head’ to take the place of the now invisible head.
First off, copy and paste the head and group it with the rest of the bits and pieces of the Humanoid model. Obviously, you’ll have to change the Transparency to whatever you need it to be (presumably 0, the default Transparency). Also make sure to move any decals from the original head onto this head. You can name the head whatever you’d like, but for the sake of this example, we will call it “FakeHead” It doesn’t matter where the head is positioned, so long as it is within the Humanoid model.
Now we are going to use the
Weld object to position and attach the fake head.
Simply stick this block of code at the beginning of a script inside the Humanoid model.
local weld = Instance.new("Weld") weld.Parent = script.Parent.Head weld.Part0 = script.Parent.Head weld.Part1 = script.Parent.FakeHead
All this is doing is creating a new Weld and using it to attach the fake head to the real head. There is no need to use CFrame, since Weld objects automatically put two objects they are welding together in the same position, unless you state otherwise using the Weld object’s