I've come across a situation that it is pivotal that I execute a command on a player using a button.
Currently, and have been using: "tp @p[r=7] <x> <z> <y>"
That will send the player to the location if they pressed the button 7 blocks away (which is the almost the range a button can be pressed) from the command block (so in practice about 5 blocks away because the command block is inside the wall).
THE PROBLEM: I have a puzzle that uses teleports AND many players can be near a button (the command block!) when pressed and someone NOT pressing the button will get teleported instead IF they are closer to the command block.
------
So how do I make this work: "tp @s <x> <z> <y>"
------
The description of @s on the wikis and in game make it sound like the "entity" (the player) is executing the command inside the command block but nothing happens. Is the "entity" the button? If so how do I *garuntee* the player pressing the button is the player that is teleported?
I've come across a situation that it is pivotal that I execute a command on a player using a button.
Currently, and have been using: "tp @p[r=7] <x> <z> <y>"
That will send the player to the location if they pressed the button 7 blocks away (which is the almost the range a button can be pressed) from the command block (so in practice about 5 blocks away because the command block is inside the wall).
THE PROBLEM: I have a puzzle that uses teleports AND many players can be near a button (the command block!) when pressed and someone NOT pressing the button will get teleported instead IF they are closer to the command block.
------
So how do I make this work: "tp @s <x> <z> <y>"
------
The description of @s on the wikis and in game make it sound like the "entity" (the player) is executing the command inside the command block but nothing happens. Is the "entity" the button? If so how do I *garuntee* the player pressing the button is the player that is teleported?
stat.useItem.minecraft.stone_button
Try to create a scoreboard using this criteia.
For the command block that is placed around the button, do this
/teleport @a[score_pressed_min=1,r=7] <x> <y> <z>
Then reset the score.
I'll read up on the scoreboard if there's a possibility of using that instead. Thanks.
While I'm familiar with some command/[block] basics I've never used/made a scoreboard.