Scoreboards & Teams: The Backbone of Every Minigame
Scores are how datapacks remember things, and teams are how they group players. Master these two systems and minigame logic stops being mysterious.
Minecraft has no variables in the programming sense — but it has the scoreboard, which is close enough. A scoreboard 'objective' is a named slot that can hold a number for each player (or for a fake player you invent as a global variable). Combine objectives with teams, and you have everything you need to run kill counts, timers, lives, currency and win conditions. Every minigame you've played leans on these two systems.
Objectives: counters with criteria
You create an objective with a name and a 'criterion'. The most flexible criterion is 'dummy' — a plain number that only changes when your commands change it, ideal for custom counters and global variables. Other criteria update automatically: 'playerKillCount' rises when a player kills another player, 'deathCount' when they die, 'health' tracks hit points. You read and write scores with /scoreboard players set/add/remove/operation.
- ▸scoreboard objectives add kills playerKillCount — auto-counts PvP kills.
- ▸scoreboard players set #timer game 600 — a global 30-second timer (#timer is a fake player).
- ▸scoreboard players add @s coins 5 — give the running player 5 coins.
- ▸execute if score @s lives matches 0 run … — react when a player is out.
Teams: grouping and visuals
The /team command creates named teams and assigns players to them. Beyond grouping, teams control friendly-fire, name-tag colour and visibility, collision, and whether members see each other through walls. In a datapack, teams let a single command target a whole side at once — execute as @a[team=blue] … — which is why team-based modes round-robin players into teams at the start of a match.
Putting it together: a win check
A typical 'last team standing' check, run every tick, counts how many teams still have living players and, if exactly one remains, announces the winner — guarded by a flag so it only fires once. None of that needs a real programming language; it's objectives, selectors and /execute working together. Once you can read a score check, you can read almost any minigame datapack.
Mine Mod AI's engines assemble these pieces for you — creating the objectives in the load function, ticking timers and generators, and writing the win condition — so the games it builds are correct and lag-free out of the box.
Build it without the busywork
Mine Mod AI turns a plain-English description into a ready-to-install Minecraft datapack or Bedrock add-on — version-correct and free to try.
Try the generator →