Skip to content

tw.progressbar

Side: Client

NUI progress bar with queue management and multiple visual themes.

Functions

tw.progressbar.start(message, duration, callback, options?)

Starts a progress bar. If one is already active, the new one is queued.

ParameterTypeDescription
messagestringText displayed on the progress bar
durationintegerDuration in milliseconds
callbackfunctionCalled on natural completion (not called if cancelled)
optionstable?Visual options (see below)

Options:

FieldTypeDefaultDescription
themestring'linear''linear' (bar), 'circle' (circle), or 'innercircle' (circle with countdown)
colorstring'rgb(124, 45, 45)'CSS color value
widthstring'20vw'CSS width value

tw.progressbar.cancel()

Cancels the currently active progress bar. The callback is not called.


tw.progressbar.cancelAll()

Cancels the active progress bar and all queued progress bars.

Examples

Linear bar (default)

lua
tw.progressbar.start("Collecting herbs...", 5000, function()
    -- This runs after 5 seconds if not cancelled
    tw.notif.rightSuccess("Herbs collected!")
end)

Circle theme with custom color

lua
tw.progressbar.start("Crafting...", 8000, function()
    tw.notif.rightSuccess("Item crafted!")
end, {
    theme = 'circle',
    color = '#ffffff',
    width = '20vw',
})

Inner circle with countdown

lua
tw.progressbar.start("Cooking meat...", 10000, function()
    tw.notif.rightSuccess("Meat cooked!")
end, {
    theme = 'innercircle',
    color = 'rgb(50, 150, 50)',
})

Cancelling on key press

lua
tw.progressbar.start("Searching...", 6000, function()
    -- completed
end)

-- Somewhere else, e.g., on player movement:
tw.progressbar.cancel()

Notes

  • The callback is only called on natural completion. If cancel() or cancelAll() is called, the callback is skipped.
  • Multiple start() calls queue the progress bars; they run one after another.
  • cancelAll() clears the entire queue, not just the active bar.

Premium RedM Scripts — Multi-Framework