• Hey! Register here to create your account, engage with the community, and talk about what is new!

how can i make it so that it shows the health of a player above their head?

Solution
I assume you don't have a rank, so here's how I would do it without holograms (for the player):

- Spawn a button (literally anywhere)
- Set it to persistent (so it never despawns), disable its gravity, and set its item pickup delay to 100000000000 (very big number)
- Create a variable named %default hpUUID and set it to the UUID of the last-spawned entity (game value)
- Call a process named 'HPLoop'

In the 'HPLoop' process:

Repeat forever
{
- Set a local variable named 'hpLoc' to the eye location of the default player and shift it on the y axis by 1
- Select all entities by the name %default hpUUID (use the variable ofc)
- Launch the selected entity towards hpLoc with 100 launch power (add to current velocity: false...

Numero

Retired Admin
Retired Admin
Joined
Sep 6, 2020
Messages
8
Reaction score
0
There are a few ways of doing this. One is through the use of holograms that are constantly updating their position and text value (requires a rank to do this), another way is by changing the displayed name of the entity to the text display you want (only works on mobs).
Either way, you'll need to custom code the amount of hearts to display in that text, and then use one of those two methods to get the hearts to display.
 

AntiTheWarNeko

New member
Joined
Feb 23, 2022
Messages
17
Reaction score
4
Kinda sad that 2 key parts in my game i cant make because i dont have a rank.

Also, is there a way i can constantly teleport a named invisible chicken to someones head or is that too complex with multiple players?
 

Jimmy_The_Knight

Well-known member
Joined
Dec 28, 2020
Messages
73
Reaction score
32
I assume you don't have a rank, so here's how I would do it without holograms (for the player):

- Spawn a button (literally anywhere)
- Set it to persistent (so it never despawns), disable its gravity, and set its item pickup delay to 100000000000 (very big number)
- Create a variable named %default hpUUID and set it to the UUID of the last-spawned entity (game value)
- Call a process named 'HPLoop'

In the 'HPLoop' process:

Repeat forever
{
- Set a local variable named 'hpLoc' to the eye location of the default player and shift it on the y axis by 1
- Select all entities by the name %default hpUUID (use the variable ofc)
- Launch the selected entity towards hpLoc with 100 launch power (add to current velocity: false, ignore distance: false)
(you can also do this with a teleport but it's gonna look very janky)
- Use 'set to text' to set a local variable to the text version of the current health of the default player (I called it 'hpText')
- Set the selected entity's name to hpText
- Select the default player
- Wait 1 tick
}

This is a simple solution because it only shows the number, but I can show you how to do it with hearts if you can hop on the server sometime soon :)
(also I have the code so if this sounds too confusing then you can just copy it lmao)
 
Last edited:
Solution

SamMan_

Forum adept
Joined
Sep 6, 2020
Messages
121
Reaction score
73
Not sure why nobody's mentioned about making the hologram/button ride the player as well for smoother movement
 
Top Bottom