Updated:

1. Setup: run once

/scoreboard objectives add points dummy "Points"
/scoreboard objectives setdisplay sidebar points
/team add red
/team add blue
/team modify red color red
/team modify blue color blue
/team modify red friendlyFire false

This creates a score to count points and two colored teams. friendlyFire false stops teammates hurting each other (see the team command).

2. Start: run when the button is pressed

/team join red @a[tag=red]
/team join blue @a[tag=blue]
/gamemode adventure @a
/clear @a
/effect clear @a
/scoreboard players set @a points 0
/spreadplayers 0 0 10 50 true @a
/give @a minecraft:wooden_sword
/title @a title {"text":"Go!","color":"gold"}
/playsound minecraft:entity.player.levelup master @a ~ ~ ~ 1 1

In command blocks, link these with chain command blocks so they run in order (see the command block guide).

3. During the game: run all the time

/execute as @a[team=red] at @s if block ~ ~-1 ~ minecraft:gold_block run scoreboard players add @s points 1
/execute if entity @a[scores={points=10..}] run title @a title {"text":"Game over!"}

In a repeating command block these run every tick. The first gives red players a point while they stand on gold, and the second checks whether anyone reached 10. For kill counts and timers see the scoreboard minigame guide, and for a countdown bar see bossbar.

The first line keeps adding points every tick while a player stands there. To count only once, tag the player and exclude the tag afterward.

4. End and reset

/tp @a 0 64 0
/gamemode adventure @a
/clear @a
/effect clear @a
/team leave @a
/scoreboard players reset @a points
/kill @e[type=minecraft:item]

Send everyone back to the lobby, reset inventories, effects, teams and points, and clean up dropped items, so the next round can start right away.

On Bedrock

Common problems

Common questions

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.