Minecraft – Why Is Is This Target Selector Argument Not Working

minecraft-commandsminecraft-java-edition

I'm creating a command which is supposed to execute a message just once when a certain score is reached.

It worked once, but I made some changes to display a better word separation by adding some whitespace in the text sections within the tellraw section. It stopped working from there, even as I undid, switched world etc.
These are the commands I am using at the moment. When I am changing the command to only execute when I am below or above a certain score (elytraFlight=5000.., elytraFlight=..5000) it works fine, but obviously keeps spamming.

/scoreboard objectives add elytraFlight minecraft.custom:minecraft.aviate_one_cm
/execute as @a[scores={elytraFlight=5000}] run tellraw @a [{"text":"[Abgehoben...]: "}, {"selector":"@p[scores={elytraFlight=5000}]"}, {"text":" flog 5 Meter!"}]

I don't want to reset the scoreboard – so that I am able to execute another command once a certain second score is reached.

Best Answer

The selector @a[scores={elytraFlight=5000}] only matches players whose score is exactly 5000. Gliding happens much faster than the very slow speed of 1/100 block per tick, so, the overwhelming majority of the time, the score will jump from <5000 to >5000 without actually hitting 5000. Try @a[scores={elytraFlight=5000..}] instead.