1

Detecting if a player's score in a scoreboard.

Ubalube's Avatar Ubalube3/19/18 11:26 pm
1 emeralds 1.2k 6
3/20/2018 8:38 pm
Ubalube's Avatar Ubalube
Hi, So I have 2 scoreboards. 1 named ATA , and DTA! (Attacker Team Amount, Defender Team Amount) Both teams have a player named Amount. The scoreboard is a dummy score and everytime you join the game, it will do this command: /scoreboard players add amount DA 1. (Defender Amount) Same thing with the Attackers but this time it is AA (Attacker Amount). On leave the game, it is /scoreboard players remove amount DA 1. Same thing with attackers but its AA. And I have a testfor commandblock that does this: testfor @a[score_DA_min=0]

And when that happens, I have at Comparator that goes to another commandblock! If anyone can help, that would be great!
Posted by Ubalube's Avatar
Ubalube
Level 60 : High Grandmaster Pyro
85

Create an account or sign in to comment.

6

1
03/20/2018 7:51 pm
Level 60 : High Grandmaster Pyro
Ubalube
Ubalube's Avatar
Sorry I am very confused, if you could walk me through it
1
03/19/2018 11:49 pm
Level 23 : Expert Engineer
Heklo
Heklo's Avatar
Hi. This system works fine, but there is a much more efficient and faster way added with the /execute command (1.8+). This command forces entities matching the selectors to run a command. For your case, you would use the following command:


/execute @a[score_DA_min=0] ~ ~ ~ scoreboard players add amount DA 1


This basically makes everyone with a score on DA add 1 to the DA for the player "amount". I would recommend teams for separating groups though, example:


/scoreboard teams add [player] Defense

/execute @a[team=Defense] ~ ~ ~ scoreboard players add amount DA 1
1
03/20/2018 7:34 pm
Level 60 : High Grandmaster Pyro
Ubalube
Ubalube's Avatar
So there is no way to testfor a scoreboard player's score? Because what I said is not working. It cannot find the entity. But I did something and now it says [16:33:42] Selector '@a[score_DA_min=0]' found nothing.
The score DA is at 0 but it still isn't finding anything
1
03/20/2018 7:46 pm
Level 23 : Expert Engineer
Heklo
Heklo's Avatar
So I think the problem you have is you're trying to check if someone doesn't have a score for DA. This cannot be done with objectives, as you are checking if they have a minimum of zero, and the default score for players does not exist, so it is not equal to zero. The only way to do this is with scoreboard teams, you can use a target selector @a[team=DA] to check for anyone on team DA, as well as @a[team=!] which just checks for anyone NOT on any team. Or you could use @a[team=!DA] which would select anyone NOT on the DA team specifically.
1
03/20/2018 8:33 pm
Level 60 : High Grandmaster Pyro
Ubalube
Ubalube's Avatar
OHH! SO basically, When they leave or die, I can do /scoreboard teams leave @p and if it is at 0, the game will end?
1
03/20/2018 8:38 pm
Level 60 : High Grandmaster Pyro
Ubalube
Ubalube's Avatar
I did it and it worked! THANK YOU SO MUCH :D
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome