Timer on screen: countdown

Data packs

A boss-bar countdown for all playersLearn more

Create a countdown boss bar for all players. At zero, show a title, play a sound, and run your commands. Download a data pack for events and minigames on Minecraft 1.21.9–26.3.

My Game select version

Save your preferences in this browser and apply them to supported tools. Settings in a shared link take priority. Wiki version labels are not affected.

How long to wait

What to write

Upon completion

Timer

Data pack · 1.21.9–26.3

Until start 05:00

Launch (operator rights)

/function timer:start

Stop

/function timer:stop
Download the data pack
What's inside the archive - 9 files

data/minecraft/tags/function/load.json

The load tag lists functions that run when the world loads and after /reload.

{
  "values": [
    "timer:load"
  ]
}

data/timer/function/load.mcfunction

On world load: countdown score.

scoreboard objectives add timer dummy

data/timer/function/finish.mcfunction

By zero: text, sound, and your commands.

title @a title {"text":"Время вышло!","color":"yellow"}
execute as @a at @s run playsound minecraft:block.bell.use master @s ~ ~ ~ 1 1

data/timer/function/main/start.mcfunction

Start a 300-second countdown with a boss bar.

bossbar remove timer:main
bossbar add timer:main {"text":"До старта"}
bossbar set timer:main color yellow
bossbar set timer:main max 300
scoreboard players set #main timer 300
function timer:main/second

data/timer/function/main/second.mcfunction

Update the boss bar and mm:ss label once per second; finish when the timer reaches zero.

execute if score #main timer matches ..0 run return run function timer:main/end
bossbar set timer:main players @a
execute store result bossbar timer:main value run scoreboard players get #main timer
scoreboard players operation #m timer = #main timer
scoreboard players operation #s timer = #main timer
scoreboard players set #60 timer 60
scoreboard players operation #m timer /= #60 timer
scoreboard players operation #s timer %= #60 timer
execute if score #s timer matches 10.. run bossbar set timer:main name ["",{"text":"До старта "},{"score":{"name":"#m","objective":"timer"}},{"text":":"},{"score":{"name":"#s","objective":"timer"}}]
execute if score #s timer matches ..9 run bossbar set timer:main name ["",{"text":"До старта "},{"score":{"name":"#m","objective":"timer"}},{"text":":0"},{"score":{"name":"#s","objective":"timer"}}]
scoreboard players remove #main timer 1
schedule function timer:main/second 1s

data/timer/function/main/end.mcfunction

When time runs out, remove the boss bar and run your end-of-timer actions.

bossbar remove timer:main
function timer:finish

data/timer/function/main/stop.mcfunction

Stop the countdown.

schedule clear timer:main/second
bossbar remove timer:main

data/timer/function/start.mcfunction

/function timer:start — start the timer.

function timer:main/start

data/timer/function/stop.mcfunction

/function timer:stop — stop and remove the timer bar.

function timer:main/stop

How to place

  1. Download the datapack

    Leave the ZIP file as it is: Minecraft can load it without extraction.

  2. Add it to your world

    In single-player mode — saves/<world>/datapacks, on the server — world/datapacks, then /reload.

  3. Start

    /function timer:start — the bar will appear for all players, and for those who join later.

What to know

  • A second — by server time. Counting starts schedule … 1s, not a tick counter: /reload will not spawn a second timer next to the first.
  • Your commands — commands in the game. Teleport to the arena, give a kit, and open the gates /fill — anything except plugin commands: they don't work in a datapack.
  • Restart — with the same startup. Repeating timer:start Starts the countdown over.

Scheduled commands without countdown — Datapack with functions, your boss mob's path — Your own boss.

Frequently asked questions

How to make a timer on screen in Minecraft?

Data pack: enter time and caption, download and place in world. /function timer:start displays a boss bar with countdown for all players.

Can you run a command when a timer ends?

Yes. Add commands to teleport players, give a kit, or open gates with /fill. They run at zero alongside the completion text and sound.

How to stop the timer?

With the command /function timer:stop, the bar disappears. Restarting the timer will begin counting again from the start.