1

I want to use a command block to testfor a player within three blocks of it. It should then activate a comparator. I followed the basic syntax, typing testfor @a [r=3]. However, when I ran it, it said that that was the wrong way to syntax it. I followed its tips, and got testfor @a {r:3} but then no matter what I tried, the comparator wouldn't turn on. Frustrated, I typed /testfor in the chat to see the proper syntax. It said testfor <player> [datatag] but when I used that syntax earlier, it gave me a syntax error! I went back and forth between them, and nothing worked.

1

You have a space in the selector.

testfor @a[r=3]

No space between @a and [r=3].

Just to note it, the comparator output signal strength will be equal to the amount of players it finds in that radius.

-1

The selector must have no space in between them.

If you do /testfor @a [r=3] the [r=3] is seen as a value and thus breaks as it cant use this as a Value. However, doing /testfor @a[r=3] means selector.

The default setup for commands is /"Command"->"target+selector"->"value". If you want it to Active for anyone place a repeater right after the comparator

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.