4

I have an objective called ninja, which can either have a score of 1 or 0. The command I am attempting to use is

/testfor @p[score_ninja=1]

However, the command returns "Found (my username)" rather than "(My username) did not match the required data structure" when ninja has a value of 0 or 1, but not if it is higher than 1.

Am I using the command wrong? Thank you in advance.

1
  • Welcome to Arqade. Good first question, I have condensed it a bit and rolled your edit into the question. There is no need to signal edits like this (in fact it's strongly discouraged), since SE has a revision history that can be accessed by clicking on "edited X ago", which shows all the changes anyone made. Check out the tour and help center if you have any more questions.
    – MrLemon
    Jun 17, 2015 at 15:35

1 Answer 1

3

This is intended.

The target selector argument score_name=X sets a maximum boundary for the score, rather than a specific value.

Selecting targets by score

[score_name=SCORE] — Selects only targets with a score in objective name of no more than SCORE.

[score_name_min=SCOREMIN] — Selects only targets with a score in objective name of no less than SCOREMIN.

For example, @a[score_points_min=30,score_points=39] will select all players with a score in objective "points" between 30 and 39 (inclusive).

To select only players/entities with a score of exactly X in the objective name, you have to both arguments at the same time, e.g.

/testfor @p[score_name_min=X,score_name=X]
0

You must log in to answer this question.

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