Progress Bar System

Progressbar

Creates a progress bar with customizable options and callbacks.

Parameters:

  • name (string) - Unique identifier for the progress bar

  • label (string) - Display text shown during progress

  • duration (number) - Duration in milliseconds

  • useWhileDead (boolean) - Whether the progress bar works while dead

  • canCancel (boolean) - Whether the player can cancel the action

  • disableControls (table) - Controls to disable during progress

  • animation (table) - Animation configuration

  • prop (table) - Primary prop configuration

  • propTwo (table) - Secondary prop configuration

  • onFinish (function) - Callback when progress completes successfully

  • onCancel (function) - Callback when progress is cancelled

Basic Usage

Progressbar(
    "drinking_coffee",           -- Unique name
    "Drinking coffee...",        -- Display label
    5000,                       -- 5 seconds
    false,                      -- Don't use while dead
    true,                       -- Can be cancelled
    {                          -- Disable controls
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true,
    },
    {},                        -- No animation
    {},                        -- No props
    {},                        -- No secondary prop
    function()                 -- On completion
        print("Coffee finished!")
        -- Add health or whatever
    end,
    function()                 -- On cancel
        print("Coffee drinking cancelled!")
    end
)

Advanced Usage with Animation and Props

Real-world Examples

Medical Treatment

Crafting Item

Best Practices

Progress Bars

  • Provide clear, descriptive labels

  • Use appropriate durations for realism

  • Always handle both completion and cancellation

  • Disable relevant controls during progress

  • Use animations and props for immersion

Last updated