I'm trying to make a minigame that's in a space station. Everyone gets a certain amount of oxygen using scoreboards.

I am stuck on how I can kill a player when they reach 0 oxygen. I have tried

/testfor @a["scoreboard name"=0]

but this does not seem to work. How can I kill the player when they reach 0 oxygen?

I am using Minecraft version 1.7.10.

  • You were on the right track, just some syntax problems. Simply put score_ in front of the "scoreboard name". I recommend replacing the /testfor command with a /kill command if you're simply using it to kill players, for simplicity's sake. Therefore your command would become /kill @a[score_<scoreboard name>=0] For future reference, /testfor is mostly useless. If you find yourself using it, i highly suggest checking everything and seeing if a /scoreboard command would suit your needs better (it almost always will). – rustphoenix Mar 10 '16 at 17:03

if you're still on 1.7 (the other answer only works on 1.8+), then try:

/effect @a[score_O2remaining=0] 20 5 100

to give those players a strong Wither effect for 5 seconds.

  • Wither is effect 20, I edited your answer accordingly. Good first answer, welcome to Arqade! Take the tour and check out the help center if you have any questions regarding the site. – MrLemon Mar 10 '16 at 19:16

Try this looped on a fill clock:

/kill @a[score_NAME_min=0,score_NAME=0]

This should kill all players that have a score of zero. All you need to do after that is set the killed players oxygen score back to 10 so that they don't keep getting killed.

  • 1
    The target selector to check for a maximum score is score_NAME, rather than score_NAME_max. – MrLemon Mar 10 '16 at 10:55
  • I don't think so, @MrLemon. The way scoreboard are working is kind of weird. You can't test for an exact value with score_WHATEVER. You need to append _max to it, if I remember correctly – Seblor Mar 10 '16 at 13:24
  • 1
    @Seblor: You are incorrect. score_NAME matches everyone who has a score equal to or less than the value, score_NAME_min matches everyone who has a score that's at least the value. Combine the two to match everyone who has a score that is exactly equal to the value. I do wish that we had score_NAME, score_NAME_min, and score_NAME_max. – MBraedley Mar 10 '16 at 13:43
  • 1
    The _0 won't do anything useful either. – rustphoenix Mar 10 '16 at 17:00
  • 1
    Note that you also cannot have spaces anywhere within the selector parameters, including between the selector and square bracket: @a[score_NAME_min=0,score_NAME=0] – Skylinerw Mar 11 '16 at 13:45

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.