For a Minecraft map I'm making, I want public messages to be sent when a player steps on a certain pressure plate or walks through a specific door, and for the message to say who exactly did it. Also, I want it to be able to handle multiple players in the same spot and does its job respectively.

For example, if a person walks into a door, it says,

"their username has walked through the door."

I'm currently using

/tellraw @a {"text":"","color":"yellow","extra":[{"selector":"@p[distance=3]"},{"text":" has walked through the door."}]}

but it doesn't seem to work, and rather responds with,

" has walked through the door."

Any thoughts?

  • 1
  • Try making the "@p[distance=..3]" instead of what it is right now. This should fix the problem with no targets being found but this command line alone won't making exactly what you want... – Bruno Rodrigues Jul 12 at 21:27
  • @BrunoRodrigues Please don't answer in comments. – pppery Jul 13 at 0:57
  • @ExpertCoder14 The answer to that question explains that " Example, this will only match someone who is exactly 0.5 blocks away from you, which is pretty much impossible to achieve with regular walking: @a[distance=0.5]". That is exactly the problem here, as pointed out in Bruno Rodrigues' comments. I don't see how that makes it not a duplicate. – pppery Jul 13 at 0:58

Minecraft uses dots to specify bigger than and smaller than when using tags such as distance=n.

  • 2 dots in front (distance=..n) stands for smaller than n.
  • 2 dots at the end (distance=n..) stands for bigger than n.

Additionally, both terms can be used in one tag (e.g.: distance=y..n stands for bigger than y and smaller than n.).

To answer your question, change distance=3 to distance=..3, problem solved.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.