I have a map that I'm making where players can choose a class but each class has certain restrictions. I am trying to find a way to set it so that if a player picks, let's say, Knight, they cannot use a bow.

I know most of the commands but my issue is having the bow only removed from the inventory of the player that chose the knight class and not any other.

Would this - clear @a[score_knight_min=1] minecraft:bow - command work so that if the player has a min score of 1 in that classes dummy score it would only remove the item from that specific player and NOT every player on the map? I would check my self but I have no way of testing it without a second player on my map.



That is exactly how target selector variables and arguments work:


Targets all players, including dead players. No other selector will find dead players.

Target selector arguments may be used to reduce the set of players targeted. For example, @a[team=Red] will only target players on team Red.

Target selectors are resolved as a whole. While @a would target every player regardless of, well, everything, @a[arg1=value1,arg2=value2] will only target those players satisfying arg1=value1 and arg2=value2.

Note that a non-sensical argument is always fulfilled, that is, any that are not listed under target selector arguments, including misspelled or wrongly capitalized arguments: @a[Name=Bob] will target all players, since Name is not valid (but name is).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.