How do i execute a command whenever a player is at a specific coordinate in 1.14+ Minecraft commands?

Im trying to execute a tellraw when they are at a specific coordinate

I tried doing this in a repeating/always active/unconditional command block

execute if entity @p positioned x y z

then i would put a comparator for power to the impulse/need redstone/unconditional command block with the command

tellraw @p "Example"

but nothing would happen.

I tried putting the tellraw with the execute command block but it would just repeat the tellraw, or making the command block not on repeat does nothing.


1 Answer 1

execute if entity @p[x=87,y=77,z=20,dx=0,dy=0,dz=0] run tellraw @p "Example"

This will run if the player is in the 87, 77, 20 block.

  • Tried to code didn't work. Maybe tell me what like conditions, types of the cmd block, and if it needs redstone or not?
    – pwnda
    Commented May 30, 2021 at 16:43
  • You can run it in a repeat, unconditional, always active command block, and the command will run on loop as long as the player is in the block. This command is an example of a condition for a command to only run if the player is at a specific position.
    – sourrabbit
    Commented May 30, 2021 at 16:54
  • this does work. But the text repeats, and i dont want that.
    – pwnda
    Commented May 30, 2021 at 16:55
  • You can add command blocks that trigger an additional condition you made, so this will only run once.
    – sourrabbit
    Commented May 30, 2021 at 16:59
  • Yes i solved it by using another commmand block thats impulse, with a comparator. THANK YOU
    – pwnda
    Commented May 30, 2021 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .