This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
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>
Edit:
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
What am I doing wrong?
What I want to accomplish is:
Edit:
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...
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