mojira.dev
MC-128107

Trying to teleport with @s in command blocks

Unable to teleport with @s in a command block I have tried all sorts of ways.
tp @s 112 102 317
/tp @s 112 102 317
etc...

Attachments

Comments 7

⚠️ Please do not mark issues as private, unless your bug report is an exploit or contains information about your username or server.

@s targets the executor of the command. In this case, it would the command block. The command block is not an entity which could be teleported, so the command fails.

Use this command for @s in command block.

/execute as @p at @s run tp @s 112 102 317

Or simply

tp @p 112 102 317

(also, the /execute as command only works in 1.13)

I am completely aware that I could use "tp @p 112 102 317" but as this is for a server I would like to ensure that the person that is getting teleported is the person that pressed the button.
Also I tried "/execute as @p at @s run tp @s 112 102 317" and it does not work. I have also tried "execute as @p at @s run tp @s 112 102 317"

I am completely aware that I could use "tp @p 112 102 317" but as this is for a server I would like to ensure that the person that is getting teleported is the person that pressed the button.

@s simply does not work in command blocks, unless you use /execute as. There currently is no (easy) way to check who pressed a button.

Also I tried "/execute as @p at @s run tp @s 112 102 317" and it does not work. I have also tried "execute as @p at @s run tp @s 112 102 317"

Both of these commands (which are the same btw) work completely fine for me.

I know they are both the same command but just for some stupid reason, I tried it anyway just so you knew.
Now if you could explain why I got these errors when using it please do.

[media]

[media]

You're using Minecraft 1.12.2. As I said before, /execute as only works in 1.13.

Kasey

(Unassigned)

Unconfirmed

Minecraft 1.12.2

Retrieved