0

I am trying to send a message to all players that are less than 20 blocks from a command block. I tried this at first:

tell @a[distance=20] Hello

But in the "Previous output" field I can see:

[20:33:21] No player was found

I also tried to add coordinates:

tell @a[x=~0,y=~0,z=~0,distance=20] Hello

But that just marks the command the command as invalid. I would ideally like to be able to set relative coordinates to the command block and require distance to them. What I'm doing is a little "Checkpoint" for adventure map. It should set player's spawnpoint on it's entrance and let them know spawnpoint was set. It uses observers and redstone ore to detect player stepping on it, then it should set the spawn point. I'd rather not use absolute coordinates to make this easier to reuse.

raft

1 Answer 1

0

With tell @a[distance=20] Hello you're targeting only players exactly 20 blocks away from your command block. Since you want to target everything in range you need to change it a bit.

This one will work properly:

tell @a[distance=..20] Hello

The .. make all the difference. You can as well target players in a range between x and y blocks:

tell @a[distance=20..50] Hi there

You must log in to answer this question.

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