View our recap of Minecraft Live, where the cave update and new mobs were introduced!
What am I doing wrong?
/execute if entity @p[x=X,y=Y,z=Z,distance=..5] run tell @s <message>
What I want to accomplish is:
Execute if player's within 5 blocks of set block, tell that player: <message>
It works when I type it in the chat, but not through a command block...
This is the only thing I need now, to release my alpha version of the map.
distance will not work in this case. Only the xyz cooridinates will.
Distance works just fine. The problem is you used @s(the executor).
When you run it in chat, you are the executor so you are the one that run and received /tell.
But if you run it in command block, well...
If the executor was not an entity, for instance if the executor was a command block or a server console, this selector will find nothing.
Change it to...
/execute as @a if entity @s[x=X,y=Y,z=Z,distance=..5] run tell @s <message>
/tell @a[x=X,y=Y,z=Z,distance=..5] <message>
Thanks guys, and OuOun to the rescue again <3