How do I send a custom Tellraw message based on the player in a certain location in Minecraft

Solution 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.