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ölingCommented Jun 5, 2019 at 21:23
Add a comment
|
1 Answer
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]
-
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" withdistance=5..
– user232393Commented Jun 5, 2019 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)– user232393Commented Jun 5, 2019 at 21:40