Run a function in 5 seconds
/schedule function mypack:countdown 5sRuns mypack:countdown once, 5 seconds (100 ticks) from now.

/schedule runs a data pack function or function tag after a delay given in ticks, seconds or in-game days. It is the clean way to build timers, countdowns and loops that should run less often than every tick. /schedule clear cancels what is still waiting.
/schedule clear <function>/schedule function <function> <time> [append|replace]| Argument | Expects | What it does |
|---|---|---|
| function | Resource ID | Function or function tag to run, for example mypack:countdown or #mypack:timers. With clear, the ID to cancel. |
| time | Duration (ticks, or 10s, 2d)at least 0 | Delay before the run: 20 or 20t in ticks, 5s in seconds, 1d in in-game days. At least one tick. |
/schedule function mypack:countdown 5sRuns mypack:countdown once, 5 seconds (100 ticks) from now.
/schedule function mypack:loop 1t appendAdds one more run of mypack:loop on the next tick, without cancelling the runs already planned.
/schedule function mypack:night 1d replaceRuns mypack:night after 24,000 ticks and replaces any pending run of the same function.
/schedule function #mypack:timers 20tRuns every function of the mypack:timers tag after 20 ticks, one second.
/schedule clear mypack:countdownRemoves every pending run of mypack:countdown.
Fill in the fields, then copy the command.
Command generatorThe delay accepts a unit: t for ticks (the default), s for seconds (20 ticks) and d for in-game days (24,000 ticks). A delay of 0t fails with "Can't schedule for current tick": the minimum is one tick. By default replace applies, so scheduling the same function again moves its single pending run to the new time. append keeps the earlier runs and adds one more.
A scheduled function does not keep the context of the command that planned it. It runs from the server, not from the player or the command block, so @s selects nobody. Select players with @a or a tag, or use /execute inside the function. Macro functions cannot be scheduled: the game answers "Can't schedule a macro". To run a function right now, use /function instead.
A function whose last line is schedule function mypack:loop 1s calls itself every second, which is much lighter than a tick function. Stop the loop with /schedule clear mypack:loop. If nothing is waiting, the game reports "No schedules with ID ...". Combine it with /scoreboard to count down a timer second by second.
✓ Checked in Java Edition 26.3 · updated 2 November 2026
The function runs from the server, not from the player who scheduled it. Select players with @a or a tag, or use execute as inside the function.
replace, the default, keeps a single pending run and moves it to the new time. append adds another run and leaves the earlier ones in place.
Type it in the chat with cheats on: /schedule clear <function>.
Cheats on, or operator level 2.