Minecraft – ny way to create a variable in minecraft

minecraft-commandsminecraft-java-edition

I know that there is no direct way to create a variable in Minecraft but is there any way to manipulate scoreboard objectives into creating one?

Basically, I need to create a variable that will store a players X Y Z when they reach less than 10 health.
The name of the "Health" objective is "down".

I'm not sure how to make this question less like a demand. I'm not sure where to start on this but the main thing that I am "Capable" of is looking online for other questions. The only thing that has come up are people asking for this to be added, but someone in a forum mentioned scoreboard objectives being able to do the trick.

EDIT

So I don't beleive I was clear enough: I need this to store the players location data live. As in a repeating command block test's for a player with less than ten health and then stores the players current location which I can then use later to teleport the player to the saved coordinates. E.g

/testfor @a[score_down=10] {Coordinated:[{X(var X) = 1,Y(var Y) = 2,Z(var Z) = 3}]}

Basicall y ^ that works like Coordinated < Position Tag, X < X position tag, var < declared that the output will be the variable.

THAT IS IMPOSSIBLE ^

But I hope you catch my drift by the way I explain it.

Best Answer

I realised that there was an alternative way to do what I needed to do and this did not involve creating a variable. The reason I wanted to know the player's location live was so I could freeze them on the spot. Instead, I used this:

/execute @a[score_down=10] ~ ~ ~ /summon ArmorStand ~ ~ ~ {Invisible:1b,Invulnerable:1b,NoBasePlate:1b,NoGravity:1b,Small:1b}

/tp @a[score_down=10] @e[type=ArmorStand]

You can, of course, give the ArmorStand a custom name to reduce glitchiness but I did not need it.