OPX//77
CreatorsServer exports

StartProgress

Last updated on

Starts a progress bar on one player's screen from the server, and learns how it ended.

local res = exports.opx_infinity:StartProgress(source, spec)

Scope write · sync.

Parameters

  • source: number

  • spec: table

    • label: string — required, cut to 64 bytes
    • durationMs: integer — required, between the progress module's MIN_MS and MAX_MS
    • cancelable?: boolean — default false
    • animation?: { name, variant? }
  • The server judges it. The client draws the bar and reports how it ended; whether it finished is decided by the server's own clock. A finished that arrives sooner than the duration is rejected and written to the security journal; no report by the duration plus 5 s is no_answer; the player leaving is left.

  • The outcome arrives on opx:on:progress:finished with your resource as owner and this id. Only completed = true means the action happened.

  • One bar per player (progress_busy). Your bars end when your resource stops.

  • Public events are advisory (any server resource can raise one): accept a verdict only for an id you started and are still waiting on, as the example does.

Returns

  • { id, durationMs }

Errors

  • progress_busy, invalid_duration, invalid_label, invalid_spec, invalid_player, export.badArgument, export.callerDenied
Example
local bars = {}
local res = exports.opx_infinity:StartProgress(playerId, { label = 'Cracking the safe', durationMs = 8000 })
if res.ok then bars[res.value.id] = playerId end

AddEventHandler('opx:on:progress:finished', function(src, done)
  if done.owner ~= GetCurrentResourceName() or not bars[done.id] then return end
  bars[done.id] = nil
  if done.completed then -- pay out: the server timed it
  end
end)

On this page

No Headings