Affect entities/players in a 4 block radius without you getting affected

I need a command that will effect players and entities in a 4 block radius with levitation, without yourself getting affected

I'm on bedrock.

(I apologize if I have bad english)


Use the /tag command combined with the not operator.


💬 Give yourself a tag!

The /tag command can be used to add and remove tags for entities; it's syntax is:

tag <entity> add <name>

I'd recommend giving yourself a tag that describes what you're using it for, simply for clarity purposes. So in this case, I recommend something like immune:

tag @s add immune

👁‍🗨 Use the radius and tag arguments.

You can limit which entities are impacted by a command's selector argument by providing additional arguments. In your case, you're interested in the radius and tag arguments which are r and tag respectively. For example, the following command will kill all entities within a 4 block radius of the command's execution position:

kill @e[r=4]

You can chain arguments together using a comma ,:

kill @e[r=4,tag=killer]

⛔️ Add the not ! operator.

Since you want to run a command that impacts all players outside of a specific criteria (e.g. you're the only one unaffected), you'll need to specify the not operator when checking the tag:

kill @a[tag=!immune]

This, combined with your radius check will kill all players within a 4 block radius, that do not have the tag immune:

kill @s[r=4,tag=!immune]

Hope this helps!