time
Time.
time.now() → number
Real seconds (equivalent to os.clock).
time.delta() → number
Last-frame delta time.
time.game() → number
In-game time, sourced from LocalPlayer.time_base (pauses when the game pauses).
time.curtime() → number
Server-authoritative time (reads client_state.curtime directly). Usually agrees with time.game(), but curtime is the only authoritative source for server-side state such as death-ring countdowns and bullet time — use it when you care about server-side ring shrink / tick sync. Returns 0 when no game state is available.
time.frame_count() → number
Render frame count, monotonically increasing, +1 per rendered frame.
| Function | Meaning | Use |
|---|---|---|
time.now() | Wall-clock seconds (equivalent to os.clock()) | Timers / throttling / any "real-time seconds" |
time.delta() | Duration of the previous frame (seconds) | Rate integration (movement, animation lerp) |
time.game() | In-game time (local-side) | Synced with in-game time (pauses when the game pauses) |
time.curtime() | Server-authoritative time | Death rings / bullet time / server-side countdowns |
time.frame_count() | Cumulative render frame count | Modulo scheduling (% N == 0), lightweight periodic tasks |
lua
-- Run a heavy task once every 60 frames (~1s @ 60fps)
event.on("frame_update", function(e)
if time.frame_count() % 60 == 0 then
do_heavy_thing()
end
end)You can also read e.delta_time from the first argument e of event.on("frame_update", fn)'s fn(e) — the value is equivalent to time.delta() with one fewer function call.