Normally I'm good at command blocks but I've hit a roadblock.
I'm using a test for command:

/testfor @a {Inventory:

for a little assassin kit, you know? Anyway I want the person with this armor on to have a speed and jump boost how can I get the same person or more with the effects? Also take notice I don't want people without the set with the effects.

  • Is the problem that the testfor command isn't working, or not finding the right object?
    – NBN-Alex
    Oct 22, 2016 at 0:59

1 Answer 1


The /testfor command is essentially useless in accomplishing that, since all it provides you is whether or not there was a match.

You will instead need to use the /scoreboard command to assign a label to targets that match NBT data, and you'd then be able to target them based on the label in other commands. You can either use a score or a "tag".


You will first need to create an objective to hold the scores in. You'd run this a single time yourself in the chat:

/scoreboard objectives add assassinKit dummy

You may then use the following on a clock, which first sets player's "assassinKit" score to 0 by default, in case they take the armor off, and then sets it to 1 afterwards if they are still wearing the particular armor set:

/scoreboard players set @a[score_assassinKit_min=1] assassinKit 0
/scoreboard players set @a assassinKit 1 {Inventory:[{id:minecraft:leather_boots,Damage:0s,Count:1b,Slot:100b},{id:minecraft:leather_leggings,Damage:0s,Count:1b,Slot:101b},{id:minecraft:leather_chestplate,Damage:0s,Count:1b,Slot:102b},{id:minecraft:leather_helmet,Damage:0s,Count:1b,Slot:103b}]}

And finally, target them based on their score:

/say Players wearing the assassin kit: @a[score_assassinKit_min=1]
/effect @a[score_assassinKit_min=1] minecraft:speed


A "tag" is a very simple string label that requires no objective, and is stored on the target among a list of other "tags". Same as before and on a clock, you'd remove it by default first, and then re-apply it:

/scoreboard players tag @a[tag=assassinKit] remove assassinKit
/scoreboard players tag @a add assassinKit {Inventory:[{id:minecraft:leather_boots,Damage:0s,Count:1b,Slot:100b},{id:minecraft:leather_leggings,Damage:0s,Count:1b,Slot:101b},{id:minecraft:leather_chestplate,Damage:0s,Count:1b,Slot:102b},{id:minecraft:leather_helmet,Damage:0s,Count:1b,Slot:103b}]}

And finally, target them based on their tag:

/say Players wearing the assassin kit: @a[tag=assassinKit]
/effect @a[tag=assassinKit] minecraft:speed

The disadvantage of tags compared to scores is the increased difficulty in targeting something based on multiple tags. All selector parameter keys must be unique, so @e[tag=1,tag=2] does not work (selecting only players with the last-specified unique key). You would instead have to add another tag (or score) based on the target's Tags NBT list:

/scoreboard players tag @a[tag=hasMultipleTags] remove hasMultipleTags
/scoreboard players tag @a[tag=tag1] add hasMultipleTags {Tags:["tag2","tag3"]}

/say Players with tags "tag1", "tag2", and "tag3": @a[tag=hasMultipleTags]

You must log in to answer this question.

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