The Meaning of Life, the Universe, and Everything.
Ok I put the execute command into a repeating command block, and then I attached a chain command block with the scoreboard reset command. As soon as I sprint, the score gets permanently set to 1, and the execute command keeps saying hi, even when I'm not sprinting.
again, command order is very important. If you set up everything correctly, the player will have a "sprinting" tag whenever he sprints. The tag will be removed when he stops sprinting so now you can do:
/execute as @a[tag=sprinting] at @s run ... on
/execute as @e[tag=!sprinting] at @s run ... off
And this one, I put on the receiving end of the comparator that's attached to the command above:
tag @a remove sprinting
Seeing that my method worked, I disabled my command blocks and I followed your steps again to see if your method would magically work, but it failed. However, when I returned to my method, it just suddenly broke and detects when I'm sprinting only for a few seconds and then goes back to detecting when I'm not sprinting.