Delay (Section) — Skript
Addon: Skript · Category: Section · Since: 1.4, 2.16 (Delayed Sections)
Syntax
(wait|halt) [for] %timespan%Description
Delays the script's execution by a given timespan. When used as an effect, all code after the <code>wait</code> runs once the delay elapses. The whole trigger pauses until the wait finishes. When used as a section, only the code within the section is deferred. Code after the section continues immediately, and the body runs on the same event once the delay elapses. This is useful for scheduling follow-up work without blocking the rest of the trigger. Note that delays are not persistent. For example, <code>ban player → wait 7 days → unban player</code> will not resume if the server restarts during the delay. Inside a section body, outer <code>loop-value</code>s are not available because the body is parsed as a separate trigger. Event values (like <code>player</code>) still work. If you need a value from before the delay, copy it to a local variable. Local variables are snapshotted when the section is scheduled, so subsequent changes aren't reflected.
Examples
wait 2 minuteshalt for 5 minecraft hourswait a tick# Section form: outer continues immediately, body runs 3 seconds later.
send "hello" to player
wait 3 seconds:
send "...and goodbye" to player
send "This runs first!" to player
wait 1 seconds:
send "This runs third! (one second later)" to player
send "This runs second!" to player