How do I put coordinates into this command so that I can run it on another block rather than the command block?
/execute if entity @p[distance..2]
I think it would look something like this:
/execute at @p if entity @p[distance=..2] run whatever_command_you_want_to_run
if you want to execute it as the player as well, you can add "as @p" right before the at statement.
Hopefully this works the way you want
This will come in handy, but how do I put coordinates inside the brackets next to distance, is what I'm asking. I'm trying to run it like a testfor command so that I can detect when a player walks on a block.
You should be able to use:
/execute at @p if entity @p[x=#,y=#,z=#,distance=..#] run command