P
Pop Storm Daily

How to apply potion effect to players in specific distance?

Author

James White

Published Jul 17, 2026

I'm trying to make my friend Bee get the weakness potion effect every time she goes 20 blocks near my other friend Kay.

How do I do this with command blocks?

1 Answer

From looking at the wiki:

execute @a[name=Kay] ~ ~ ~ execute @a[name=Bee,rm=0,r=20] ~ ~ ~ effect @s weakness <time> <amplifier>

Which translates to:

Execute at Kay, as Bee if closer then 20 blocks (inclusive), give them (Bee) an effect