tick
() -> number seconds from a monotonic clock
Rate Limiting an Action
Lifecycle: Shared
The clock counts from an arbitrary origin, so only the difference between two readings has meaning.
Luau
local COOLDOWN = 1.5local lastFired = -math.hugelocal function tryFire(): boolean local now = tick() if now - lastFired < COOLDOWN then return false end lastFired = now return trueendprint("First shot allowed:", tryFire()) Output: First shot allowed: true