How can I testfor a nearby player in minecraft 1.13 [duplicate]
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...
Solution 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!