How detect a fake player with the highest score in a scoreboard in Minecraft 1.13?

In a minigame I created, I have a scoreboard dummy objective called "Gold" and two fake players called "Team_Red" and "Team_Green" that are holding the scores for team "Red" and team "Green" respectively. I would like to create a game over title command for all players, displaying "Team ____ Won." I have a scoreboard timer set for 6 minutes and once that ends, the title will be shown displaying who won. It seems that there are no target selectors that can test for this, so how can this be done? You can't "testfor" anymore either. So how can one do this in Minecraft 1.13?


execute has an if score subcommand that lets you easily compare any two scores, and run a command if the test succeeds. The following commands should work for what you want to do:

execute if score Team_Red Gold > Team_Green Gold run title @a title {"text":"Team red won!","color":"red"}
execute if score Team_Red Gold < Team_Green Gold run title @a title {"text":"Team green won!","color":"green"}
execute if score Team_Red Gold = Team_Green Gold run title @a title {"text":"It's a draw!","color":"gray"}