Im trying to make a world where survivors have to live for 5 minutes, or the "Hunter" has to kill all the survivors within 5 minutes. Im using an xp timer for the clock, so all im stumped on is how to check when the there is only one player left (the hunter).


1 Answer 1


How to Strictly Detect Number Returned by Target Selector

This would be possible in Java Edition 1.13+, by storing the number in a scoreboard value and testing it for a specific number. But in Bedrock Edition, so far, I only can test for presence or absence, not a specific number.
Commands in Bedrock Edition are quite limited. One way I could think of is using a redstone comparator coming out of the command block, which will light up a redstone signal equal to the number of players detected, but that comes with further side effects, such as only being able to detect up to 15 players.

That said, there may be an obscure way to accomplish your task, but I’m not the best at advanced command use in BE. If you have found a way, please post an answer! Both me and the OP would be delighted to see it.

  • I found a way! you can use a reverse circuit. Here's how: Repeating Command Block : /testfor @a [scores={objectivename}] then run a comparator from the block, 1 redstone dust and then attach it to a block with a redstone torch on it, for a reverse circuit, then the following command blocks should do your desired function when there is only one remaining player on your objective list. Commented Jun 26, 2020 at 22:12
  • i was trying to edit it to 0, but what i did is gave the hunter a 0 value, instead of 1, in the pregame. so when everyone else is dead, teleporting them to a room that gives a 0 value, when there are no more 1 values (all dead or hunter) the hunter wins. thank you for giving me the idea of the comparator! Commented Jun 26, 2020 at 22:44
  • yes! my setup is, when a new game is started, it wipes the scoreboard completely, like removes the objective and everything. it re-adds the scoreboard, then everyone in the lobby, to avoid the Player Offline tag on the scoreboard, and if you are the hunter for the game you get taken to an intermission room for 15 seconds while the survivors run around the map. here, your value is reset to 0, and when you die to the hunter, you get sent to a "dead" room where you can spectate, and your value is also reduced to 0. now all i need to know is how to detect when someone has a sword on them. Commented Jun 26, 2020 at 22:57
  • reason being, im trying to give the hunter gradual speed increases for the time passing, so it makes it harder for survivors. Commented Jun 26, 2020 at 22:58
  • yes, and when you die you get sent to a "dead" room that resets your value to 0, so you are no longer in the game. Commented Jun 26, 2020 at 23:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .