Progress
A flexible, lightweight, and animated progress bar system for FiveM. Supports 2D HUD bars, 3D in-world bars, animations, prop attachments, and control disabling.
🛠️ Core Functions
You can access the progress bar using exports.
ShowProgress (Standard 2D)
The "Fire and Forget" method. Handles the timer, animation, and cleanup automatically.
exports['ak47_lib']:ShowProgress(data, onFinish, onCancel)Parameter
Type
Description
data
table
Configuration object (see below).
onFinish
function
(Optional) Callback when the bar reaches 100%.
onCancel
function
(Optional) Callback if the bar is cancelled (e.g., player moved or pressed X).
CancelProgress (Standard 2D)
Cancel the running 2d progress.
exports['ak47_lib']:CancelProgress()CreateProgress (Advanced 3D)
Returns a Progress Object that you must manually control. Useful for minigames, persistent HUD elements, or skills where progress isn't time-based.
local bar = exports['ak47_lib']:CreateProgress(data)Object Methods:
bar.show(): Displays the bar.bar.update(value): Sets the percentage (0-100).bar.destroy(): Removes the bar immediately.
📦 Data Object Configuration
The data table defines how the progress bar looks and behaves.
Basic Settings
Property
Type
Default
Description
label
string
"Progress"
Text displayed on the bar.
duration
number
3000
Time in milliseconds (if not manual).
type
string
"capsule"
Visual style (see Styles below).
canCancel
boolean
false
If true, pressing X (73) cancels the action.
reverse
boolean
false
If true, the bar goes from 100% to 0%.
3D World Options
Property
Type
Default
Description
is3d
boolean
false
If true, the bar floats in the world.
coords
vector3
Player Pos
World coordinates for the bar.
distance
number
10.0
Max visibility distance for 3D bars.
State Restrictions
Property
Type
Default
Description
useWhileDead
boolean
false
Cancel if player dies?
allowSwimming
boolean
false
Cancel if player enters water?
allowFalling
boolean
false
Cancel if player falls?
allowRagdoll
boolean
false
Cancel if player gets ragdolled?
Control Disabling (disable sub-table)
Prevent player input while the bar is active.
Animation (anim sub-table)
Play an animation or scenario.
Props (prop sub-table)
Attach one or more objects to the player.
🎨 Visual Styles
You can change the appearance of the progress bar by setting the type field in the data object.
Type
Description
capsule

minimal

segments

pulse

radial-smooth

radial-orbit

radial-ticks

radial-dashed

📝 Examples
Example 1: Basic Repair (Linear)
Simple interaction with a callback.
Example 2: Medical Action (Complex)
Uses props, animations, and disables controls.
Example 3: Manual HUD (Object Oriented)
Useful for skill checks or minigames where the script controls the percentage.
Example 4: 3D World Progress
Attach a progress bar to a specific coordinate in the world (e.g., a door being drilled).
Last updated