Updated:
1. Build the floors
/fill 0 63 0 9 63 9 minecraft:lime_concrete
/fill 11 63 0 20 63 9 minecraft:red_concrete
Green (x 0 to 9) is true, red (x 11 to 20) is false, with a one-block gap between them.
2. Ask the question
/title @a times 10 100 10
/title @a subtitle {"text":"Stand on true or false"}
/title @a title {"text":"Lightning makes creepers stronger"}
Run subtitle before title (title and tellraw).
3. Score the right floor
/scoreboard objectives add quiz dummy "Correct"
/scoreboard objectives setdisplay sidebar quiz
/scoreboard players add @a[x=0,y=64,z=0,dx=9,dy=3,dz=9] quiz 1
If the answer is false, use x=11 instead. See area detection.
4. Eliminate wrong answers
/gamemode spectator @a[x=11,y=64,z=0,dx=9,dy=3,dz=9]
5. Reset for the next question
/tp @a[gamemode=adventure] 10 64 -3
See the minigame commands for the overall flow.
6. Prepare players before the game
/gamemode adventure @a
/scoreboard players reset @a quiz
/tp @a 10 64 -3
Put everyone in adventure mode, clear old scores and gather players at the start. Step 5 only moves players in adventure mode, so this matters.
7. Add a time limit
/scoreboard objectives add qtimer dummy
/scoreboard players set #q qtimer 200
Set the timer to 200 ticks (10 seconds) when you ask each question. Names that start with # stay off the sidebar. Put the next lines in an always-active repeating command block followed by chain command blocks.
# Repeating block
execute if score #q qtimer matches 1.. run scoreboard players remove #q qtimer 1
# Chain 1
execute if score #q qtimer matches 0 run scoreboard players add @a[x=0,y=64,z=0,dx=9,dy=3,dz=9] quiz 1
# Chain 2
execute if score #q qtimer matches 0 run gamemode spectator @a[x=11,y=64,z=0,dx=9,dy=3,dz=9]
# Chain 3
execute if score #q qtimer matches 0 run scoreboard players set #q qtimer -1
The check runs once when the timer reaches 0, then the timer is parked at -1. When the answer is false, swap x=0 and x=11 in chains 1 and 2. To show the seconds left, add a countdown.
8. Eliminate players off both floors
/tag @a remove onfloor
/tag @a[x=0,y=64,z=0,dx=9,dy=3,dz=9] add onfloor
/tag @a[x=11,y=64,z=0,dx=9,dy=3,dz=9] add onfloor
/gamemode spectator @a[gamemode=adventure,tag=!onfloor]
This stops players from hiding in the gap or outside the floors. Clear the tag, tag everyone on a floor, then eliminate anyone without it. Run it just before steps 3 and 4.
9. Reveal the answer and crown a winner
/title @a title {"text":"Answer: TRUE","color":"green"}
/playsound minecraft:entity.player.levelup master @a[x=0,y=64,z=0,dx=9,dy=3,dz=9]
execute store result score #alive quiz if entity @a[gamemode=adventure]
execute if score #alive quiz matches 1 run tellraw @a [{"selector":"@a[gamemode=adventure]"},{"text":" wins!","color":"gold"}]
Show the answer and play a sound only for players who got it right. The third line counts who is left, and when one player remains, the chat announces the winner. For a points game instead, the top name on the sidebar wins.
Troubleshooting
- No points: the area must start one block above the floor.
- No title: the title line must run last.
- Bedrock: write
/title @a title Question text; the area checks are the same.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.