Minecraft – How would you /effect someone with chainmail boots with only 1 command block

minecraft-commandsminecraft-java-edition

I am making a Hide and Seek map on one of my friends realms, and I want to make certain boots give different effects (such as diamond boots give speed). I have something with two command blocks right here:

  1. /testfor @a{[team=Hider]Inventory:[{id:"minecraft:chainmail_boots"}]} |

Then a comparator to the next.

  1. /effect minecraft:resistance 1 3 true |

But that only effects the nearest player to the command blocks.

Best Answer

I'm not near a computer but a from what I remember you are looking for /execute [selector] x y z [command] So your command would be:

/execute @a{[team=Hider]Inventory:[{id:"minecraft:chainmail_boots"}]} ~ ~ ~ effect minecraft:resistance 1 3`