-1

This question already has an answer here:

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?

marked as duplicate by Fabian Röling, greg-449, Schism, RudolfJelin, Wondercricket May 13 at 12:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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 May 23 '16 at 23:23
1

**UPDATE**

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 May 24 '16 at 0:57
  • The teams you only need to do once. – RookieTEC9 May 24 '16 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 May 25 '16 at 20:45
1
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.