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.
| Parameter | Type | Description |
|---|---|---|
message | string | Text displayed on the progress bar |
duration | integer | Duration in milliseconds |
callback | function | Called on natural completion (not called if cancelled) |
options | table? | Visual options (see below) |
Options:
| Field | Type | Default | Description |
|---|---|---|---|
theme | string | 'linear' | 'linear' (bar), 'circle' (circle), or 'innercircle' (circle with countdown) |
color | string | 'rgb(124, 45, 45)' | CSS color value |
width | string | '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()orcancelAll()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.

