Library · Overextended

ox_lib for FiveM

What it is

The shared library half the modern FiveM ecosystem depends on: menus, notifications, progress bars, zones, callbacks and a cache.

ox_lib is not a feature, it is the standard library. It provides the context menus, input dialogs, progress bars, notifications and zone helpers that dozens of other resources call instead of writing their own. If a script's README says it has no dependencies except ox_lib, that is why.

Official documentation Repository All resources

At a glance

MaintainerOverextended
Latest releasev3.39.0 · 2026-07-13
Last code change2026-09-04
LicenceLGPL-3.0
Written inLua
GitHub stars416
StatusActive

Figures read from the repository on 2026-09-22.

Why servers run it

  • One UI language across every script. A server running ten ox_lib-based resources has one notification style and one menu style, for free.
  • The zones module replaces PolyZone for new code — boxes, spheres and polygons with enter, exit and inside handlers.
  • Server callbacks without boilerplate: lib.callback.await replaces the trigger-event-and-wait-for-a-reply dance.
  • lib.cache keeps the common client values — ped, vehicle, seat, weapon — current without a per-frame loop in every resource.

Installing ox_lib

  1. 1. Download a release, not the source

    ox_lib's web UI is built per release. Cloning the repository gives you the source without the compiled interface, and the menus silently do nothing.

  2. 2. Drop it in and start it first

    ensure ox_lib before anything that depends on it. It has no dependencies of its own.

  3. 3. Add the Lua import line

    Every resource that uses it needs shared_script '@ox_lib/init.lua' in its fxmanifest.lua. Without it, lib is nil.

  4. 4. Turn on Lua 5.4

    Add lua54 'yes' to the fxmanifest of anything using ox_lib. The library targets 5.4 features.

Working examples

fxmanifest.lua — wiring ox_lib into your own resource

fx_version 'cerulean'
game 'gta5'
lua54 'yes'

shared_script '@ox_lib/init.lua'

client_script 'client.lua'
server_script 'server.lua'

A weapon shop menu in ten lines

lib.registerContext({
    id = 'weapon_shop',
    title = 'Ammu-Nation',
    options = {
        { title = 'Custom Pistol', description = '$2,500',
          icon = 'gun', onSelect = function() buy('WEAPON_CUSTOMPISTOL') end },
        { title = 'Custom Rifle',  description = '$18,000',
          icon = 'gun', onSelect = function() buy('WEAPON_CUSTOMRIFLE') end },
    }
})

lib.showContext('weapon_shop')

A progress bar that cancels cleanly

if lib.progressCircle({
    duration = 4000,
    label = 'Cleaning the weapon',
    useWhileDead = false,
    canCancel = true,
    disable = { move = true, combat = true },
    anim = { dict = 'amb@world_human_clipboard@male@idle_a', clip = 'idle_c' },
}) then
    -- finished
else
    -- the player cancelled; nothing was consumed
end

What goes wrong

Cloning the repo instead of downloading a release is the number one ox_lib problem. The web/build folder only exists in the release zip.

Missing `shared_script '@ox_lib/init.lua'` makes lib nil in your resource, with an error that does not mention ox_lib at all.

lua54 'yes' is required. Without it you get parse errors on files that use 5.4 syntax.

lib.callback.await blocks the coroutine. Calling it in a tight loop or inside a per-frame thread will stall the thread, not the server.

ox_lib — questions people ask

Do I need ox_lib if I do not use ox_inventory?
Yes, if any resource you run declares it as a dependency — and most modern ones do. It is small, it has no dependencies itself and it is safe to run alongside anything.
Is ox_lib a replacement for PolyZone?
For new code, largely yes. lib.zones covers box, sphere and poly zones with the same enter/exit/inside model. PolyZone is still required by older resources that call it directly.
Where are the ox_lib docs?
coxdocs.dev/ox_lib. Every module has its own page with the full argument list and a runnable example.

Runs alongside

ox_inventory

The slot-based inventory most new FiveM servers start with, with first-class support for addon weapons, durability, metadata and shops.

ox_target

The third-eye interaction system most modern scripts target: look at a thing, get a menu, click an option.

oxmysql

The MySQL wrapper the modern FiveM stack runs on: promise-based, prepared-statement aware and a drop-in replacement for mysql-async.

PolyZone

The zone library that taught FiveM to think in shapes: polygons, boxes, circles and entity zones with enter and exit events.