I'm making a horse racing track and I want the game to say "[name of horse] has finished the race!" when a horse crosses the finish line. I can get it to say the name of every horse in the area, but not just the one that activates the block.
Minecraft – How to get a command block to say the name of a named mob
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – How to use ~ in /testfor command block
- Minecraft – How to detect the death of a mob
- Minecraft Bedrock Edition – How to Use Command Blocks to Display Nearest Player’s Name in Chat
- Minecraft – Command Block Question for “if, then” statement
- Minecraft-Commands-Minecraft-Bedrock-Edition – How to Detect a Player on Specific Blocks in Minecraft Bedrock Edition
- Minecraft – How to change the direction of a command block chain? 1.15.2+
Best Answer
If you're activating the command block with a pressure plate you could use the
@e
selector combined withsort=nearest
andlimit=1
like this:If players are riding the horses you could also add
type=horse
in the selector: