PcoWSkbVqDnWTu_dm2ix

Character Name/Health Display

Character Name/Health Display

10 min

The Humanoid instance is used to create character models, both for players and NPCs. When inserted into a Model that has a Head part, Roblox will display its name and/or health bar.

Display Distance Type

The character’s name and health can be configured through the Humanoid/DisplayDistanceType property.

When a player character's Humanoid/DisplayDistanceType is set to Viewer, the player will see the name/health of other characters within their own character's Humanoid/NameDisplayDistance and Humanoid/HealthDisplayDistance, regardless of those value settings for the other characters.
In the image above, the player sees names within 15 studs of their character, which includes both Watchman and Octavia. However, the player only sees health bars within 10 studs, which excludes Octavia.
When a character's Humanoid/DisplayDistanceType is set to Subject, it takes full control over its own name/health display through its Humanoid/NameDisplayDistance and Humanoid/HealthDisplayDistance values. Thus, player characters will only see character information within those distances set on the subject.
In the image above, both Watchman (blue character) and Octavia are set to Subject and their Humanoid/NameDisplayDistance ranges are indicated by the circles. Only the name Octavia is seen by the player whose character is standing inside her range but outside the Watchman range.
When a character's Humanoid/DisplayDistanceType is set to None, its name and health bar will not be displayed under any circumstances.

Name Occlusion

Occlusion (hiding) of humanoid names behind walls or other objects is controlled by the player character’s Humanoid/NameOcclusion property.

When a player character's Humanoid/NameOcclusion is set to NoOcclusion, names and health bars will never be occluded for humanoids hidden behind non-transparent objects.
When a player character's Humanoid/NameOcclusion is set to OccludeAll, names and health bars will always be occluded for humanoids hidden behind non-transparent objects.
When a player character's Humanoid/NameOcclusion is set to EnemyOcclusion, names and health bars will be occluded for enemies (players on a different Player/Team|Team) hidden behind non-transparent objects, but names/health of teammates will not be occluded.

Health Display Type

A character’s health bar visibility can be further controlled through its Humanoid/HealthDisplayType property.

If a character's Humanoid/HealthDisplayType is set to AlwaysOn, its health bar will always appear.
If a character's Humanoid/HealthDisplayType is set to DisplayWhenDamaged, its health bar will only appear when its current Humanoid/Health|Health is less than its Humanoid/MaxHealth|MaxHealth.
If a character's Humanoid/HealthDisplayType is set to AlwaysOff, its health bar will never appear under any circumstances.

Display Name

By default, a character’s display name will match the name of its character Model, but it can be overridden through the Humanoid/DisplayName property. The value can be set directly on an NPC humanoid in Studio, but player characters should be handled as follows:

  1. From a LocalScript, fire a articles/Remote Functions and Events|remote event to request changing that player’s display name on the server. This functionality can be connected to a TextBox name entry or whatever suits the experience’s interface.
  1. In a server-side Script, listen for the remote event and use articles/Text and Chat Filtering|text filtering to assign the requested name to the player character’s humanoid.
Tags:
  • humanoid
  • display
  • name
  • health