-1

This question already has an answer here:

Have been searching a couple of hours now just so I can find out how I can testfor a nearby player... One thing I noticed is that testfor doesn't even work anymore so whats the deal with that? I have been using /testfor @a[r=5] but yeah, not anymore...

marked as duplicate by Virusbomb, Community Aug 16 '18 at 18:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

r and rm have now become a range called distance. For example:

  • @a[distance=..5] selects people 5 meters or closer
  • @a[distance=2..6] selects people 2 to 6 meters away
  • @a[distance=7..] select people 7 meters or further away

The replacement for testfor depends on what you were using it for, but the closest equivalent for most cases would be execute if entity. For example:

execute if entity @a[distance=..3] run say Someone is within 3 blocks!
  • Well, apparantly the commands were all working, but me being me I didn't toggle "always active" – TheDutchDoge Aug 16 '18 at 18:17

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