I'm making a PVP-style server for a group of my friends and I, and I wanted to make it so when a player was holding a "Dark Gnome's Shadow Wand" (a stick) in their hotbar or offhand, that it would trigger a command block to give them the blindness potion effect. I got the command to work before with scoreboards, but it would target everyone, which made it difficult to balance around...is there a way to target only one player with custom named items such as this?

  • You should provide the commands you're using that is not working as you intend. Your description sounds as though you're not using the commands correctly but we can't know that without having the commands.
    – Skylinerw
    Commented May 23, 2016 at 23:23

2 Answers 2

scoreboard players set @a potion 0  
scoreboard players set @a potion 1 {SelectedItem:{id:"XXX",tag:{XXX}}}  
effect @a[score_potion_min=1] ....  

That should do it. Just put 3 command blocks on clock after each other.



You wanted it to target 1 person.
Simply make teams for each player, then copy the command block thingamiga by using the @a[team=XXX] where XXX is the team. Then, add everyone to their own team. This means it will only target 1 person / team at a time

To make teams:

/scoreboard teams add XXX 

To select the team:

/tp @a[team=XXX] OR /tp @p[team=XXX] (doesn't have to be tp) 
  • @peter I'm not sure what you mean? Would I type this into a repeating command block, or make an individual team for each player?
    – quacak
    Commented May 24, 2016 at 0:57
  • The teams you only need to do once.
    – Roke
    Commented May 24, 2016 at 20:03
  • Is there an easier way to do it than this? I wanted the players to join 2 different teams, Dwarves and Gnomes and have it so Gnomes would be effected if they held the special wand in their hands.
    – quacak
    Commented May 25, 2016 at 20:45

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