How to execute a command on everyone except me?

How to execute a command on everyone except me? - Man Holding a Megaphone

For a game I have been making, I want to (before I use @p) make the /execute command find everybody else except me. I tried:

/execute @a[type=!Player,name=username] /myCommand

But it doesn't work! Can anybody help?

Note: [username] is to be replaced with the user's Minecraft name.



Best Answer

You'll want to use the NOT operator with the name parameter:

/execute @a[name=!username] ~ ~ ~ /say Test

As well, the type parameter is not used with the @a selector.




Pictures about "How to execute a command on everyone except me?"

How to execute a command on everyone except me? - Man With Megaphone Pointing
How to execute a command on everyone except me? - Unrecognizable woman holding paw of dog
How to execute a command on everyone except me? - Crop hacker silhouette typing on computer keyboard while hacking system



How do you execute a command as someone else in Minecraft?

Type the command in the chat window and press the Enter key to run the command. Once the cheat has been entered, the flame particle will appear directly 1 block in front of the entity running the command.

How do you use commands without others seeing?

You can use the /say command to send a public message to all players in a Minecraft world (see also /msg, /tell or /w for private message).



Minecraft Execute Command [1.19] Tutorial




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

Images: Pressmaster, Pressmaster, Ivan Babydov, Anete Lusina