I am making a class system and I want a message to be played when the class fails to be unlocked (a command block wasn't activated after a specific input). After the sequence plays, I want to use a /say command to tell the player that the class wasn't unlocked.

  • 1
    I think you should show us what commands you are using to clarify this question. – Jason_ Feb 21 '16 at 5:12
  • 1
    What Minecraft version are you using? – SirBenet Feb 21 '16 at 11:20
  • I'm using 1.8.9 and playing on a Realm. The command is just /say @p Tank class unlocked! You may now select it in the class room. – Wombatorks Feb 21 '16 at 13:12
  • can you tell us what the sequence is? Are you in a room that allows you to click a button or like that to choose the classes? – Jason_ Feb 26 '16 at 20:05
  • As Jason_ said, what are the requirements for the class to be unlocked? What needs to happen? It is a bit hard to answer the question without this info. – angussidney Feb 27 '16 at 6:23

You can check the SuccessCount integer tag value of a command block by using the /testforblock command. If the value is 0, the command block either did not activate or did not run its command successfully. Replace the coordinates with the command block you want to check:

/testforblock X Y Z minecraft:command_block -1 {SuccessCount:0}

The above command block would output if the other command block did not, and you can use that signal to activate your desired commands to notify the player.

  • Is this repeatable? Or would you have to reset the command block every time? – angussidney Feb 27 '16 at 6:19

It requires a redstone signal but I have commands for it. Just levels though I'm still getting scoreboard. You need 2 different command blocks at the front before any others (Only if you make it cost an amount)

Command 1: /tellraw @p[lm=(Level Required *Or Higher*)] 
Command 2: /tellraw @p[l=(Level if too high)]
  • Ok, it looks like this is going somewhere. You got the scoreboard commands yet? I feel like this topic is pretty interesting. – Wombatorks Feb 24 '16 at 12:20
  • I have scoreboard! – user139815 Mar 9 '16 at 0:52
  • In scoreboard you can put a number for a person so that the command block would only pass if its a specific number like "2" meaning "You Can Only Use The Second Class." Read Below For Command Information – user139815 Mar 9 '16 at 0:54
  • Command One Certain Level: /scoreboard players test @p (Score Counter Name) 1 1 Command Two Level Required And Over: /scoreboard players test @p 1 999999 NOTE: Put A Redstone Comparator After the tester – user139815 Mar 9 '16 at 1:02

OK, lets say you press a button to get the class. The button powers some restone. One branch leads to the command block, that gives you, say, an iron chestplate, if you have over 5 levels of xp:/give @p minecraft:iron_chestplate[lm=5] Now, the second branch takes away the xp:/xp -5l[lm=5] Now, put a comporator facing out of the command block that gives you the chest plate. The comporator powers more redstone. Now, lets visit the third branch of restone. It leads to a command block that tells you it wasn't a succes:/tellraw @p text:"" You did not have enough xp. Make sure that this third branch has, say, 3 reapeters at full ticks. Now, lets visit the first and second line. They don't have any restone repeaters. They lead to a piston that somehow disrupts the third restone wire(I will leave that up to you, so it is of conveniance) You must time it so if the person has enough xp, the wire leading from the kit command blocks will push a piston or whatever, disrupting the restone signal, then the other restone signal comes through, going for the /tellraw command block, hits the piston, is stopped, and then the piston retracts. I know this will work, but all the text way be a bit scatterbrained! I hope this works for you!

  • I've actually tried doing this, but couldn't get the timing right. Thanks anyway. – Wombatorks Mar 2 '16 at 22:21

If you have a comparator outputting from said command block if will toggle on or off, depending on if the command block outputted sucessfully.If that is connected to a block with a redstone torch on it, then it will invert the signal. This signal can be sent to another command block that can display your message.

protected by Community Mar 3 '16 at 16:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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