I'm almost done my map, but I'm having a problem with my /give commands.

When you use @p to select the nearest player to give items to, it selects the nearest player to the command block. The problem is, the nearest player isn't always the activating player, i.e., the player that activated the command block.

How can I make sure that the item is given to the person who triggered the command block, who may not always be the nearest player?

1 Answer 1


If possible, you can use tags (I hope you know about tags).

So, you can put a pressure plate and in that command, attach/give the tag to the user in a map.
Then, you can just give it to /give @a[tag=<yourtagname>]

I guessed this helped you.

P.S. I'm new to Minecraft and I have tried it beforehand as I can't trust my logic before testing.

  • You can try it as im not like 100% sure i think it works :D Commented Oct 21, 2021 at 8:29
  • 2
    Welcome to Arqade! It might be helpful to link in some references to wikis, in case people that find this answer don't know how to use tags, etc. It can also be helpful to show a full command, including how to assign tags.
    – Ben
    Commented Oct 21, 2021 at 9:11
  • thanks it worked
    – Noah A.
    Commented Oct 23, 2021 at 8:51

You must log in to answer this question.

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