Minecraft – Displaying sidebar scores of entities with CutomName

minecraft-commandsminecraft-java-edition

I'm trying to make a countdown called "Preparation", showing the seconds before game starts. In order to do that I created a team, "P" and joined a horse with custom name "TimeRemaining" and an objective called Preparation, setting the horse's score every second, so the sidebar would look like this:

Preparation (objective)

Time Remaining 60 (Seconds based on the horse's score)

But it instead uses the hexadecimal UUID of the horse looking like this:

Preparation

uuu-00045634534547dhninqw843 60

Is there any way to force Minecraft using the customName, or an alternative way to represent the countdown?

Best Answer

You will need to use a fake player rather than an entity with a custom name.

To set:

/scoreboard players set TimeRemaining Preparation 10

To add/remove:

/scoreboard players remove TimeRemaining Preparation 1
/scoreboard players add TimeRemaining Preparation 1

To test for a value range:

/scoreboard players test TimeRemaining Preparation 0 5