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)
/tag command combined with the not operator.
/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
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
tag respectively. For example, the following command will kill all entities within a 4 block radius of the command's execution position:
You can chain arguments together using a comma
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:
This, combined with your radius check will kill all players within a 4 block radius, that do not have the tag immune:
Hope this helps!