I'm trying to use a command that will testfor @p but exclude a specific player. This is the command I tried but it does not function:

/testfor @p[r=3,!name=name here]

The commands need to function with version 1.12.2


It's name=!Horst for a player "Horst".

  • I That tried that, but it just says can't find entity. – Tortle Nov 11 '17 at 12:46
  • Is there a player online that is not called the name in your command? – Fabian Röling Nov 11 '17 at 14:26
  • If I enter /say abc @p[name=!FaRo1] def, I get "abc def", so it should work. Are you sure that the player(s) that you want to find is in a radius of 3 blocks? – Fabian Röling Nov 11 '17 at 14:33

You got close. The exclamation point goes after the equals sign in the target selector. The fixed command is:

/testfor @p[r=3,name=!<name>]

I imagine the reason you got a down vote is because this question has an easy to obtain answer. Here is the wiki on the subject. The page is actually the wiki on all Minecraft commands and can be very useful when working with commands.

  • Yes, I know It's an easy to obtain answer, but for some reason it dosen't work. – Tortle Nov 11 '17 at 12:49
  • 1
    What is not working about it? What are you attempting to do with it? How are you executing it? I only ask because, as is, the command is not all that useful. – IronAnvil Nov 11 '17 at 16:03

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.