1

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)

2 Answers 2

3

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!

0
0

You can try this:

give @a[name=!YOURNAME, r=4] dirt 1

Replace YOURNAME with your Minecraft username and when you run it, it should give everyone within 4 blocks (except from the username entered) a dirt block.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .