I have tried to display a score value and a text above the player character/ under the name but all my attempts have failed (ish).
The score value i want to display is the player Xp level. I did it by running this command:
/execute as @a[limit=1,sort=random] store result score @s level run data get entity @s XpLevel 1
The text i want to show is the players rank. The higher level the player has the better rank for exemple if the player is in level 6 > 9 the player has iron rank... I did this by running example this command:
/execute as @a[level=6..9] run tag @s add iron_rank
Now i just want to display the level and rank above the players character/ under the name. My Idea was to display the level score was to simply display the score belowname with this command:
/scoreboard objectives setdisplay belowName level
But when i switched to third person i couldn´t see the score under my name/over the character for some reason.
My idea to display the rank was to summon and then teleport an small and invisible armor stand with a custom name at the player. This works but the armor stand can be in the way for the player if you want to interact with something above you!
-
/summon armor_stand ~ ~ ~ {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoBasePlate:1b,NoGravity:1b,Small:1b,CustomName:"{\"text\":\"Rank: iron\",\"color\":\"gray\"}",Tags:[iron_rank]},CustomNameVisible:1b
-
/execute as @a[limit=1,sort=random,tag=iron_rank] at @s run tp @e[type=minecraft:armor_stand,tag=iron_rank] ~ ~1.5 ~
I also tried this with the level score but it has the same problems and it will require 1 command block per level! (The rank also require 1 command block per rank but it will be like 10 ranks but infinit levels)
belowName
display slot in singleplayer.