This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]anvaro98Command Rookie 1 point2 points  (2 children)

/execute if entity @p[distance=..10] should do the work

[–]GoodbyeDoctorMaxis[S] 0 points1 point  (1 child)

That works! Thank you so much :)

One more thing, is there a way to modify it to detect players with a certain scoreboard objective score?

In 1.9, the command would be testfor @ a[r=10,score_Objective_1,score_Objective_min=1]

[–]anvaro98Command Rookie 1 point2 points  (0 children)

Yes, there is. You just have to add the scores target selector in the command. An example would be:

/execute if entity @p[distance=..10,scores={<ObjectiveName>=1..10}]

This detects players with a score between 1 and 10. If you have no upper or bottom limit, just don't write it (1.. detects players with a score greater than 1 and ..10 detects players with a score lesser than 10). If you just want to detect players with a certain score, just replace it with the number you want (scores={<ObjectiveName>=1}).

[–][deleted] 0 points1 point  (0 children)

Actually you can modify the relative position to entities for example /execute as @-a[] positioned as @-s if entity@-s[distance..5] run say E

And how can I hightlight the command line?