Delay and Clear Data Pack Functions
The /schedule command lets you set a timer to run a data pack function after a specific delay, or cancel a function that is already waiting to run. You can set the wait time using game ticks, seconds, or in-game days.
Map makers and server creators use this command to create timed events, cooldowns, and delayed traps without building large redstone repeater chains. It requires permission level 2, which means cheats must be turned on in single-player worlds.
/schedule clear <function>/schedule function <function> <time>/schedule function <function> <time> append/schedule function <function> <time> replace/schedule function <function> <time>/schedule function <function> <time> append/schedule function <function> <time> replace/schedule clear <function>| Argument | Type | What it means |
|---|---|---|
<function> | resource ID | The namespaced resource ID of a function or a #function tag from a loaded data pack. |
<function> | function | The namespaced resource ID of a function or a #function tag from a loaded data pack. |
<time> | time at least 0 | The waiting duration before the function runs, which must be at least 0 and can be written in ticks (like 100), seconds (like 5s), or days (like 2d). |
/schedule function custom:start_game 100Runs the start_game function after waiting 100 game ticks.
/schedule function arena:spawn_wave 5sWaits 5 seconds before running the spawn_wave function.
/schedule function events:daily_reward 2dDelays the daily_reward function for 2 time units (d).
/schedule function traps:arrow_volley 30s appendAdds a new 30-second timer for the arrow_volley function while keeping any earlier timers for it active.
/schedule function minigame:end_round 60s replaceResets the timer for the end_round function to 60 seconds, replacing any previous schedule.
/schedule function #dungeon:boss_phases 200Schedules all functions inside the boss_phases function tag to run after 200 ticks.
/schedule clear custom:start_gameCancels any active timers waiting to run the start_game function.
Measured from the game files of every Java release from 1.13 to 26.3.
Bedrock Edition also has a /schedule command, but it uses a different syntax structure such as /schedule delay add <function: filepath> <time: int> [DelayMode: DelayMode] or /schedule delay add <function: filepath> <time: time> [DelayMode: DelayMode].
The command was first added in Java Edition 1.14, and in version 1.15 it was updated with the clear, append, and replace options.
You can stop a function from running by typing /schedule clear followed by the exact namespaced ID of the function or function tag.
You need permission level 2, which means you must be a server operator or have cheats enabled in your single-player world.
/bossbar/data/execute/function/random/return/scoreboard/tag/team/trigger