0

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?

4
  • 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...
    – BunnyMerz
    Commented Jul 12, 2020 at 21:27
  • @BrunoRodrigues Please don't answer in comments.
    – pppery
    Commented Jul 13, 2020 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
    Commented Jul 13, 2020 at 0:58

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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