How to teleport a player who activates a command block without using @p?

How to teleport a player who activates a command block without using @p? - Serious black man using laptop while classmates playing with ball

Using command blocks, how can I make the person that touched the command block's button get teleported, not the person closest to the command block?



Best Answer

This is impossible. The closest you can get is by specifying that it should teleport the player closest to the button, like this:

/tp @p[x=buttonX,y=buttonY,z=buttonZ] newLocationX newLocationY newLocationZ

e.g.:

/tp @p[x=420,y=42,z=-1337] 1024 37 2000001



Pictures about "How to teleport a player who activates a command block without using @p?"

How to teleport a player who activates a command block without using @p? - Concentrated African American learner sitting in chair and browsing netbook for studies against classmates playing with ball
How to teleport a player who activates a command block without using @p? - From below of ethnic boy in hoodie controlling robot using panel while standing in light room
How to teleport a player who activates a command block without using @p? - Crop unrecognizable person using console in hands while playing videogame on blurred background



How do you teleport someone with a command block somewhere?

Type this command in when having the command block GUI open /teleport @p <x> <y> <z> . Then, activate the command block with redstone (including buttons, levers, and pressure plates), and they will be sent to their destination. The player can set up multiple different teleports.

What is the command to teleport a player to you?

You can teleport other players, too. Just type their username before the coordinates \u2014 so if you're trying to teleport a player named JohnDoe, you'll type: /tp JohnDoe 70 70 70. And if all you want is to teleport yourself to JohnDoe (or any other player), just type: /tp JohnDoe.

Can you place command blocks without op?

Due to the power of the command blocks, there are a few conditions that need to be met in order to use them in your server. First, you will need to enable command blocks directly in the server settings. Secondly, you will need to be OP on the server and in creative mode to be able to place the block.

What does @P mean 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.



How To Teleport Without Using Lever/Button Or a Pressure Plate! ( - M.C - )




More answers regarding how to teleport a player who activates a command block without using @p?

Answer 2

The thing about command blocks is that they are operated by redstone signals, which can vary from circuts as small as a single button to circuts as huge and sprawling as mob farms to complex circuts like self-powered timers. Redstone signals do not carry identity (they may not even have it), so there isn't a way to tell who pushed a button.

The Guy With the Hat's answer is good to use - teleport the player closest to the structure. You will likely get more perfect mileage if you use a pressure plate on top of the block instead of a button, and then you can use a radius limiter on the @p (I think it's r=1 or whatever other number) to ensure that some random player won't get teleported when a mob presses the button.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Monstera, Monstera, Vanessa Loring, Erik Mclean