Why isn't @p (at p) targeting the correct player?
I have a line of command blocks targeting @p
, but they target seemingly random players. the person closest to the button will get teleported and given like 2 items, while a person 5 blocks behind them will get all the rest of the items and their gamemode updated.
I've tried rearranging the command blocks with and without chain command blocks, what do I do?
Best Answer
Your issue probably is that you are teleporting them first. The simplest solution is to call the tp
command last. You might be doing:
/give @p apple #Targets nearest player
/tp @p 5 10 7 #Teleports them farther
/gamemode @p survival #Still gets nearest player, but someone else might be closer now
Simply swap the teleport command to be last:
/give @p apple #Targets nearest player
/gamemode @p survival #Changes gamemode of nearest player
/tp @p 5 10 7 #Teleports player
Pictures about "Why isn't @p (at p) targeting the correct player?"
How does @P work in Minecraft?
The \u201c@p\u201d is a target selector. The selector \u201c@p\u201d selects the nearest player. Alternatively, you could also use your Minecraft username, but if you run a command from the console you will always be the nearest player.How do you target a player in Minecraft?
The @p target selector is used to target the nearest player in the game. The nearest player will always be the player closest to the location where the command is run. If a command block has executed the command, the nearest player to the command block will be targeted.What does TP @P do?
Then, use the Tp command to teleport to the coordinates....Minecraft Tp Command Examples.CommandEffect/tp @a @sTeleport all players to you./tp @p @sTeleport the nearest player to you.3 more rows•Mar 26, 2022How do you make a command block teleport to the nearest player?
So, stand in front of the command block with your pointer (the plus sign) on the command block and click on the right mouse button. This will bring up the programming console for the command block. Now, type your command in the "Console Command" text box. We use the /tp command to teleport the player.Why Isn't It Possible
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: tyler hendy, Pixabay, Karolina Grabowska, Karolina Grabowska