Minecraft – How to execute a command on everyone except me

minecraft-commandsminecraft-java-edition

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.