How do I give an effect to all players that are not in the radius of 4 around my villager?

How do I give an effect to all players that are not in the radius of 4 around my villager? - Bokeh Photography of Person Holding Turned-on Iphone

I have the command:

execute @e[type=Villager] ~ ~ ~ effect @a[r=!4] 19 5 2

It should give poison to all players that are not in the radius of 4 blocks around my villager, but it does not work.

Is there an issue with [r=!4]?



Best Answer

Replace the @a[r=!4] with @a[rm=5]. The rm stands for minimum radius, so everyone with a minimum radius of 5 will be affected, but everyone with a radius that is less than 5 will not be affected. Your final command should then be:

execute @e[type=Villager] ~ ~ ~ effect @a[rm=5] 19 5 2

EDIT: I saw afterwards that @GiantTree also said this, sorry if it is seen as a copy, but I didn't see it there.




Pictures about "How do I give an effect to all players that are not in the radius of 4 around my villager?"

How do I give an effect to all players that are not in the radius of 4 around my villager? - Free stock photo of adolescent, adult, anonymous
How do I give an effect to all players that are not in the radius of 4 around my villager? - Athletes in a Huddle
How do I give an effect to all players that are not in the radius of 4 around my villager? - Two Beach Volleyball Giving Fist Bump Gesture



How do you give a player an effect?

Effect Command in Minecraft Windows 10 Edition
  • player is the name of the player (or a target selector) that you wish to give the effect to or remove the effects from.
  • effect is the name of the potion effect to add. (See Minecraft Effects.)
  • seconds is optional. ...
  • amplifier is optional. ...
  • true is optional. ...
  • false is optional.


  • How do you use the effect command in Minecraft?

    Using the effect command in Minecraft In order to give an effect, the syntax is: "/effect give <targets> <effect> [seconds] [amplifier] [hideParticles]". In order to remove an effect, it is: "/effect clear <targets> [effect]". The target tag refers to the username of the player.

    How do you test a player for a radius in Minecraft?

    2. Type the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.




  • HOW TO MAKE SPINNING PARTICLES!!! | Minecraft Bedrock Tutorials




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Daria Shevtsova, cottonbro, cottonbro, RODNAE Productions