Minecraft – How to set separate scoreboard

minecraft-commandsminecraft-java-edition

I've created a capture-the-flag style map with command blocks, and I've tried to get rid of all the bugs that were in my map. The only thing that still doesn't work, however, is the scoreboard.

When red team scores a point, it will add a point for them on the scoreboard, but it will also add one for the blue team too, which shouldn't happen.

This also happens vice-versa, so if the blue team were to score, the red team would also score at the same time.

A last example would be that if a potato and an egg were on blue team and a chicken and wolf were on red, if red gets 3 points blue will also get 3 points in the scoreboard display of the red team.

Blue team:

(Blue): Potato 1 (true)
(Blue): Egg 1 (true)
(Red): Chicken 1 (false)
(Red): Wolf 1 (false)

Red team :

(Red): Chicken 3 (true)
(Red): Wolf 3 (true)
(Blue): Potato 3 (false)
(Blue): Egg 3 (false)

EDIT :

Commands for blue:

/scoreboard teams add EquipeBleue
/scoreboard objectives setdisplay list PointsBleu
/scoreboard teams option EquipeBleue color blue
/scoreboard teams option EquipeBleue friendlyfire false
/scoreboard objectives add PointsBleu dummy Points Equipe Bleue
/scoreboard players add @a PointsBleu 1

Commands for red:

/scoreboard teams add EquipeRouge
/scoreboard objectives add PointsRouge dummy Points Equipe Rouge
/scoreboard objectives setdisplay sidebar PointsRouge
/scoreboard teams option EquipeRouge color red
/scoreboard teams option EquipeRouge friendlyfire false
/scoreboard players add @a PointsRouge 1

Best Answer

Currently, your command setup has a few problems. You've got two different scoreboard scores for the two teams, displaying those scores in different locations, and adding a point to all players (by using just @a without specifying which players you actually want).

The simple solution is to use a team selector in your point-increment system.

/scoreboard players add @a[team=TeamName] PointsName 1

Boom. Your system, as you have it designed right now, will work. This will select all of the players on TeamName and give them a point in their designated scoreboard.

However, from a design standpoint, there's a much better way to do this by using fake players. To start, set up just one scoreboard and put it in the sidebar:

/scoreboard objectives add points dummy Points
/scoreboard objectives setdisplay sidebar points

Now, the /scoreboard players command doesn't actually require you to specify a player that is online. In fact, that player doesn't even need to exist. But it will happily keep a score for them. So, whenever you want to increment the team score, you can just do this:

/scoreboard players add Team points 1

What this will give you is a scoreboard that keeps track of team points in one entry, in one scoreboard. That way, players can compare, at a glance, what the score is, without needing to rely on the tab menu.