Minecraft – How to teleport a player that has two specific scores in Minecraft

minecraft-bukkitminecraft-commandsminecraft-java-edition

I am making a bukkit minecraft server and I want to know how to make a player that has a score of 1 on one scoreboard objective, and 3 on another.

Something like this right?

/tp @a[score_scoreboard=1,score_anotherscoreboard=3] (coords)

Best Answer

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)