How can I fix "expected '{' as first char" in my testfor command?

How can I fix "expected '{' as first char" in my testfor command? - I Hate Nothing About You With Red Heart Light

How do you use the testfor command to detect if a player has a certain score?!

I tried,

/testfor @a [score_A_min=10]

but it says, "expected '{' as first char".



Best Answer

Short answer, you have an extra space where none should be

/testfor @a[score_A_min=10]

Long answer, the syntax for testfor is

/testfor <player> [dataTag]

where <player> is required and [dataTag] is optional. More importantly dataTag is not the target selector argument (which you are trying to use), but a compound NBT tag, which is indeed contained in {}, e.g. {XpLevel:3}.

The target selector argument has to follow the target selector immediately without a space in between, like this

@<variable>[<argument>=<value>,<argument>=<value>,…]. 



Pictures about "How can I fix "expected '{' as first char" in my testfor command?"

How can I fix "expected '{' as first char" in my testfor command? - An Encouragement Quotes on Brown Paper
How can I fix "expected '{' as first char" in my testfor command? - Photo of Man Wearing Black Jacket While Standing Near Table
How can I fix "expected '{' as first char" in my testfor command? - Close-up Photo of Handletter on a White Surface



What replaced the Testfor command in Minecraft?

The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.

How do I use the Testfor player command?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.




  • Fix ; Expected (Semicolon Expected) Error in Unity




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Designecologist, RODNAE Productions, Andrea Piacquadio, Anna Tarazevich