0

Say I have a scoreboard named var, is there a way to use this score as an argument in a command? For instance:

\tp playername ~ playername.var ~

which should teleport the player with the name playername to the Y coordinate equal to their var score.

Edit: My question is, is this possible?

4

2 Answers 2

0

No, this is not possible (well, easily)

Minecraft sadly does not support insertion of scoreboard scores anywhere in a command, they can only be used in selectors (e.g. @a[score_myScore_=1]) or in the /scoreboard players test command.

However, there are a few (albeit complicated) workarounds. They work by running a bunch of conditional teleportation commands using distances decrementing in binary.

This command block modules fits your example, although I believe it uses the 1.8 command blocks. It shouldn't be too hard to adapt though, the mechanism is fairly intuitive.

However, that only fits your specific case. There is no general solution. 90% of the time you'll be able to do some binary version for that specific situation though, and if you ever make a good one, please let the community know :D

-3

You can access scoreboard values like so

/tp player player{scoreboard=var=(what their score is)} 
1
  • Hi lucas, we prefer if answers can give a little context - can you add a little explanation as to how exactly this works?
    – Robotnik
    Commented Feb 27, 2017 at 7:04

Not the answer you're looking for? Browse other questions tagged .