How do I teleport a player that has two specific scores in Minecraft
Solution 1:
Assuming your Bukkit plugins don't interfere with vanilla commands (and if one does, go and hit the plugin dev with oak wood planks), your problem is most likely a misunderstanding of the target selector arguments.
There are two target selector arguments for every scoreboard objective: score_NAME=X
and score_NAME_min=X
, where NAME
is the name of the objective, and X
is an integer number. The first one checks for the maximum, the second for the minimum score needed to be a valid target. To target someone with an OBJ1
of at exactly 4, you have to use both.
@a[score_OBJ1_min=4,score_OBJ1=4]
This can be expanded almost infinitely with more objectives, for example
@a[score_OBJ1_min=4,score_OBJ1=4,score_OBJ2_min=2,score_OBJ2=2,score_OBJ3_min=66,score_OBJ3=99]
would target any player with an OBJ1
score of 4, OBJ2
score of 2, and OBJ3
score between 66 and 99 (inclusive).
In your teleport example, you'd use
/tp @a[score_scoreboard=1,score_scoreboard_min=1,score_anotherscoreboard=3,score_anotherscoreboard_min=3] (coords)
Solution 2:
To those looking at this and using 1.13+, here's the new format (using MrLemon's example):
/tp @a[scores={scoreboard=1,anotherscoreboard=3}] X Y Z
You may also run the command as the player directly:
/execute as @a[scores={scoreboard=1,anotherscoreboard=3}] at @s run tp @s X Y Z
TIP: Adding ellipses (..) you can get a range of values:
-
scoreboard=..2
= any value less than or equal to 2 (including negative values) -
scoreboard=0..2
= any value greater than or euqual to 0 and less than or equal to 2 -
scoreboard=2..
= any value greater than or equal to 2