Minecraft Commands – Understanding SuccessCount in Version 1.11

minecraft-commandsminecraft-java-edition

I am working on my map and I really want to know WHY the SuccessCount tag doesn't work anymore in 1.11?
I got at this conclusion when I tried to test if there are 2 players in a certain area. I read all the commands again in again, place and replaced back the command blocks (the command blocks can bug sometimes) and even brought a second account in that area to be sure.

enter image description here

1execute @e[type=armor_stand,name=lobby] ~ ~ ~ testfor @a[r=10,c=2]

2/testforblock ~1 ~ ~ minecraft:repeating_command_block -1 {SuccessCount:2}

3say test

Can someone help me with this? I tried so many solutions, but it kinda gets tidious to do anymore. I would like an explanation or maybe other solution.

Best Answer

It is working correctly; you are receiving the success count from the /execute command, not the /testfor command. If there is only 1 armor stand running the /testfor command, then the success count is going to be 1 if that /testfor command succeeds (causing /execute to succeed the 1 time).

You will need to rely on other methods to track total, such as removing /execute and using hard-coded coordinates:

/testfor @a[x=10,y=64,z=10,r=10,c=2]

Or scores to track the number of players (and detect that score instead of the SuccessCount value):

/scoreboard players set #NearLobby OBJ 0
/execute @e[type=armor_stand,name=lobby] ~ ~ ~ /execute @a[r=10,c=2] ~ ~ ~ /scoreboard players add #NearLobby OBJ 1
/scoreboard players test #NearLobby OBJ 2 *