2

So I was using a command block and I made it unconditional, repeat, and always active I put the command /execute if entity @p[distance=5] and I put a redstone comparator in front of it but when I walk near it, the redstone comparator doesn’t activate I need help.

  • I used to believe that repeating command blocks never gave out comparator output, because it's never needed. They should actually do it, so this is a valid question, but I still recommend changing your setup so you don't need it. It's always possible and usually improves game performance, command performance (because you don't have the redstone delay anymore) and often makes it clearer what happens in what order. – Fabian Röling Jun 5 '19 at 21:23
2

You are checking if the nearest player is exactly 5 blocks away, to check if the nearest player is up to 5 blocks away you can use:

/execute if entity @p[distance=..5]
  • Thank you very much – Azn Flash Jun 5 '19 at 21:29
  • You can define a range like "at least 4 blocks away, up to 5 blocks away" by using distance=4..5, or "at least 5 blocks away" with distance=5.. – user232393 Jun 5 '19 at 21:39
  • May I ask what you want the redston output for? As Fabian already said, there may be a better solution. (I personally kinda like doing that, too though) – user232393 Jun 5 '19 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.