How to make scoreboard show teams instead of players?

I am trying to make it to where points for teams are shown in the scoreboard but I can only manage to get player names on there, what command do I use? On 1.16


Solution 1:

For this you need a second scoreboard. Let's say that single_scores is the scoreboard that you already have. I'll call the shared one team_scores:

/scoreboard objectives add team_scores dummy "Insert display name here"

Now whenever you want to update the scores, you need to first reset them:

/scoreboard players reset * team_scores

And now add all team scores to the correct dummy players per team:

/scoreboard players operation blue team_scores += @e[team=blue] single_scores
/scoreboard players operation green team_scores += @e[team=green] single_scores
/scoreboard players operation yellow team_scores += @e[team=yellow] single_scores
…

This way the sum of the blue team appears as "blue" in the sidebar, if you set it to display team_scores instead of single_scores. You can even give both the same display name if you want to pretend that they're the same.