I need to know how to detect if a player kills a zombie so I can finish my game where zombies attempt to attack a castle and you have to defend it. I want to make so that when you kill 50 zombies you win the game.

if this is possible please tell me how to do it.

  • Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
    – Frank
    Feb 25 '17 at 22:05
  • i'm stuck at every part. Feb 25 '17 at 22:07
  • What part is, "every part"? What have you tried to solve this?
    – Frank
    Feb 25 '17 at 22:30
  • i'm stuck at every part and I used other posts on this website and other websites and they are all outdated. May 31 '17 at 1:08
  • So what is every part? Show us what you've tried! Not doing so makes it sound like you want us to do it all for you.
    – Frank
    May 31 '17 at 1:50

You can add an objective of type stat.killEntity.Zombie, which will keep track of how many zombies the player has killed:

/scoreboard objectives add KillZombie stat.killEntity.Zombie

You can select people who have killed 50 zombies with @a[score_KillZombie_min=50]. For example, to teleport them somewhere:

/tp @a[score_KillZombie_min=50] X Y Z
  • ok. so, how to I set the score back to 0? Feb 25 '17 at 22:13
  • also, will "/title @a[score_KillZombie_min=50] Title [text:"you won!]" work? Feb 25 '17 at 22:17
  • nevermind I found out how to set it to zero Feb 25 '17 at 22:40

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.