How to select players who are not two specific players in Minecraft? [duplicate]
![How to select players who are not two specific players in Minecraft? [duplicate] - Two Fit Young Men Walking Along Volleyball Net on Sandy Beach How to select players who are not two specific players in Minecraft? [duplicate] - Two Fit Young Men Walking Along Volleyball Net on Sandy Beach](/assets/images/how_to_select_players_who_are_not_two_specific_players_in_minecraft_duplicate_0.jpeg)
Say I want to have a command that applies to everyone on a server except 2 people. Is there a target selector for that?
Best Answer
In order to do an all-but target selector, you need to add an exclamation point (!) before the name of the thing excluded from the command.
For example, the command
/testfor @a[name=!IfThenElse]
would return true if there is a player other than the player with the name IfThenElse online when the command is executed. In order to modify this command, simply replace the name IfThenElse with a different username.
With the all-but you can make an effective entity clearer:
/kill @e[type=!Player]
This would kill all entities (minecarts, mobs, dropped items) except for players.
However, since you can only select one all-but name, the scoreboard must be used.
Start by using the command
/scoreboard objectives add testnot dummy
and setting testnot to 1 on players you don't want to be effected by whatever command:
/scoreboard players set IfThenElse testnot 1
Replace IfThenElse with a username. Then you can run a command with the target selector
@a[score_testnot=0]
, which would effect everyone but the players who had their testnot score set to 1.
I'm going to be surprised if I got the command syntax right. Edit as needed.
Pictures about "How to select players who are not two specific players in Minecraft? [duplicate]"
![How to select players who are not two specific players in Minecraft? [duplicate] - Two Beach Volleyball Giving Fist Bump Gesture How to select players who are not two specific players in Minecraft? [duplicate] - Two Beach Volleyball Giving Fist Bump Gesture](/assets/images/how_to_select_players_who_are_not_two_specific_players_in_minecraft_duplicate_1.jpeg)
![How to select players who are not two specific players in Minecraft? [duplicate] - Men Playing Football How to select players who are not two specific players in Minecraft? [duplicate] - Men Playing Football](/assets/images/how_to_select_players_who_are_not_two_specific_players_in_minecraft_duplicate_2.jpeg)
![How to select players who are not two specific players in Minecraft? [duplicate] - Athletes In Red and White Ice Hockey Jersey How to select players who are not two specific players in Minecraft? [duplicate] - Athletes In Red and White Ice Hockey Jersey](/assets/images/how_to_select_players_who_are_not_two_specific_players_in_minecraft_duplicate_3.jpeg)
How do you target specific entities in Minecraft?
The @e target selector is used to target all entities in the game. This includes both players and mobs in the world. Notice that in this last example, we have used [type=enderman] to target only enderman. This value is called a target selector argument and allows us to filter the target.What does @R mean in Minecraft?
The other target selectors are \u201c@a\u201d for all players, \u201c@r\u201d for a random player, and \u201c@e\u201d will target all entities. Entities include everything that isn't a block, like monsters, snowballs, animals, and arrows.How do you find multiple people in Minecraft?
Minecraft Interactive Experience Sends a private message to one or more players. /tell or /w can also be used.7 BEST KEYBOARD SHORTCUTS in MINECRAFT!
More answers regarding how to select players who are not two specific players in Minecraft? [duplicate]
Answer 2
Normal target selectors cannot select 2 specific people, the solution is to use a scoreboard to mark the players.
Setup:
/scoreboard objectives add Selector dummy
Clock:
/scoreboard players set @a[name=<Name of Target>] Selector 1 //One of these commands per person
/scoreboard players set @a[score_Selector_min!=1] Selector 0
Selector:
@a[score_Selector=0] to select non selected
Answer 3
So from what people have said and some of my own research here's the easiest way to do this:
Set up a scoreboard, called ExcludeSelection for example:
/scoreboard objectives add ExcludeSelection dummy
Set the players you want to exclude to 1 in this scoreboard:
/scoreboard players set <username> ExcludeSelection 1
(do this for every player you want to exclude)Add 0 to all player's scores (basically this adds players not on the scoreboard to the scoreboard without messing up existing values):
scoreboard players add @a 0
(in a loop, perhaps a setblock clock)And then to select all players except the ones you want to exclude, just use:
@a[score_ExcludeSelection=0]
I personally am using this to prevent anyone except the co-owners of the server (moi and my friend) from using creative mode. Just because I feel like it, here's what I think I'm going to do in addition to the first four steps.
In a setblock clock, I'll put tell @a[score_ExcludeSelection=0,m=1] You are not allowed to use creative mode.
in one command block, and in another, gamemode @a[score_ExcludeSelection=0,m=1] survival
.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: RODNAE Productions, RODNAE Productions, Yahye Abdi, Саша Лазарев