Free Script Library — ESX, QBCore & Standalone

Free FiveM Scripts
For Your Roleplay Server

A growing library of clean, commented, ready-to-paste Lua scripts for FiveM — labeled by framework, with dependencies declared and install instructions included. ESX Legacy, QBCore, and standalone.

Server-Side Validated Code
Used on 2,000+ Servers
Every Line Commented

Check the framework label: each script is markedESXorQBCoreor standalone. Dependencies (ox_lib, oxmysql, qb-target) are declared in each script — make sure your server runs them before pasting.

The Script Library

Each card shows the framework and file layout. Tap any script to copy it instantly.

fxmanifest.lua Template

UniversalStarter

The foundation of every FiveM resource. Correct load order, shared scripts, and dependencies declared the way the FiveM docs recommend.

Manifest · Universal
fx_version 'cerulean'
game 'gta5'

author 'Your Server Name'
description 'My custom resource'
version '1.0.0'

shared_scripts {
    '@ox_lib/init.lua',
    'config.lua'
}

client_scripts {
    'client.lua'
}

server_scripts {
    '@oxmysql/lib/MySQL.lua',
    'server.lua'
}

lua54 'yes'

QBCore Mining Job (Client + Server)

QBCoreJobQBCore

A complete QBCore job: mine ore at a zone with progress bar, receive an item, sell it for cash. Server-side validation so rewards cannot be faked.

Job · QBCore
-- client.lua
local QBCore = exports['qb-core']:GetCoreObject()

local miningZone = nil

CreateThread(function()
    exports['qb-target']:AddTargetModel('prop_rock_4_big2', {
        options = {
            {
                type = 'client',
                event = 'miningjob:client:Mine',
                icon = 'fas fa-hammer',
                label = 'Mine Ore',
                canInteract = function()
                    return not IsPedInAnyVehicle(PlayerPedId(), false)
                end
            }
        },
        distance = 2.5
    })
end)

RegisterNetEvent('miningjob:client:Mine', function()
    if lib.progressCircle({
        duration = 5000,
        label = 'Mining...',
        position = 'bottom',
        canCancel = true,
        disable = { move = true, car = true, combat = true }
    }) then
        TriggerServerEvent('miningjob:server:RewardOre')
    end
end)

-- server.lua
local QBCore = exports['qb-core']:GetCoreObject()

local COOLDOWN = 6 -- seconds between rewards
local lastMine = {}

RegisterNetEvent('miningjob:server:RewardOre', function()
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if not Player then return end

    local now = os.time()
    if lastMine[src] and now - lastMine[src] < COOLDOWN then return end
    lastMine[src] = now

    Player.Functions.AddItem('steel', 1)
    TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['steel'], 'add')
end)

ESX 24/7 Shop with ox_lib

ESX LegacyShopESX

A simple ESX Legacy shop: open a menu at a marker, buy items with validated server-side payment. Works with esx_menu or ox_lib.

Shop · ESX Legacy
-- client.lua
ESX = exports['es_extended']:getSharedObject()

local shopItems = {
    { name = 'water',  label = 'Water Bottle', price = 5 },
    { name = 'bread',  label = 'Bread',        price = 8 },
    { name = 'bandage', label = 'Bandage',     price = 15 }
}

CreateThread(function()
    while true do
        local sleep = 1000
        local coords = GetEntityCoords(PlayerPedId())
        local dist = #(coords - vector3(25.7, -1347.3, 29.49))
        if dist < 15 then
            sleep = 0
            if dist < 1.5 then
                ESX.ShowHelpNotification('Press ~INPUT_CONTEXT~ to open the shop')
                if IsControlJustReleased(0, 38) then
                    openShop()
                end
            end
        end
        Wait(sleep)
    end
end)

function openShop()
    local options = {}
    for i, item in ipairs(shopItems) do
        options[i] = {
            title = item.label .. ' - 
#x27; .. item.price, onSelect = function() TriggerServerEvent('shop:server:BuyItem', item.name) end } end lib.registerContext({ id = 'shop_menu', title = '24/7 Shop', options = options }) lib.showContext('shop_menu') end -- server.lua ESX = exports['es_extended']:getSharedObject() local PRICES = { water = 5, bread = 8, bandage = 15 } RegisterNetEvent('shop:server:BuyItem', function(itemName) local src = source local xPlayer = ESX.GetPlayerFromId(src) local price = PRICES[itemName] if not price or not xPlayer then return end if xPlayer.getMoney() >= price then xPlayer.removeMoney(price) xPlayer.addInventoryItem(itemName, 1) TriggerClientEvent('esx:showNotification', src, ('Bought for $%s'):format(price)) else TriggerClientEvent('esx:showNotification', src, 'Not enough money') end end)

Vehicle Speed Limiter (QBCore)

QBCore / StandaloneUtility

A standalone-friendly driver aid: toggle a speed limiter from inside any vehicle. Great example of client-side state with a proper command handler.

Utility · QBCore / Standalone
-- client.lua
local limiterOn = false
local LIMIT_KMH = 80

RegisterCommand('limiter', function()
    local ped = PlayerPedId()
    if not IsPedInAnyVehicle(ped, false) then
        return lib.notify({ title = 'Get in a vehicle first', type = 'error' })
    end
    limiterOn = not limiterOn
    lib.notify({
        title = limiterOn and ('Limiter ON - ' .. LIMIT_KMH .. ' km/h') or 'Limiter OFF',
        type = limiterOn and 'success' or 'error'
    })

    CreateThread(function()
        while limiterOn and IsPedInAnyVehicle(PlayerPedId(), false) do
            local veh = GetVehiclePedIsIn(PlayerPedId(), false)
            local speed = GetEntitySpeed(veh) * 3.6
            if speed > LIMIT_KMH then
                SetVehicleForwardSpeed(veh, LIMIT_KMH / 3.6)
            end
            Wait(50)
        end
    end)
end, false)

ESX Job Garage (Spawn + Impound)

ESX LegacyJobGarage

A duty-police style garage: spawn a job vehicle at a marker, and the previous one gets deleted to stop duplicate vehicles. Classic ESX pattern.

Job · ESX Legacy
-- client.lua
ESX = exports['es_extended']:getSharedObject()

local GARAGE = vector4(454.6, -1017.4, 28.4, 90.0)
local VEHICLE_MODEL = 'police'
local SPAWN = vector4(438.4, -1018.3, 27.7, 90.0)

CreateThread(function()
    while true do
        local sleep = 1000
        local ped = PlayerPedId()
        local coords = GetEntityCoords(ped)
        if #(coords - GARAGE.xyz) < 20 then
            sleep = 0
            ESX.Game.Utils.DrawText3D(GARAGE.xyz, '[E] Take Vehicle', 0.4)
            if #(coords - GARAGE.xyz) < 2 and IsControlJustReleased(0, 38) then
                local job = ESX.GetPlayerData().job
                if job and job.name == 'police' then
                    ESX.Game.SpawnVehicle(VEHICLE_MODEL, SPAWN.xyz, SPAWN.w, function(vehicle)
                        TaskWarpPedIntoVehicle(ped, vehicle, -1)
                    end)
                else
                    ESX.ShowNotification('You are not police')
                end
            end
        end
        Wait(sleep)
    end
end)

Discord Logging Webhook

UniversalAdminLogging

Send rich embeds to Discord for important server events — payments, deaths, admin actions. Every serious FiveM server needs this pattern.

Server Admin · Universal
-- server.lua
local WEBHOOK_URL = GetConvar('discord_webhook', '')

local function sendDiscordLog(title, description, color)
    if WEBHOOK_URL == '' then return end
    PerformHttpRequest(WEBHOOK_URL, function() end, 'POST', json.encode({
        username = 'Server Logs',
        embeds = {
            {
                title = title,
                description = description,
                color = color or 3447003,
                footer = { text = os.date('%Y-%m-%d %H:%M:%S') }
            }
        }
    }), { ['Content-Type'] = 'application/json' })
end

-- Example: log every player connection
AddEventHandler('playerConnecting', function(name)
    local src = source
    sendDiscordLog(
        'Player Connected',
        ('**%s** joined with ID %d'):format(name, src),
        65280 -- green
    )
end)

-- Example: log a purchase from your shop resource
RegisterNetEvent('shop:server:BuyItem', function(itemName)
    local src = source
    local name = GetPlayerName(src) or 'Unknown'
    sendDiscordLog(
        'Purchase',
        ('%s bought %s'):format(name, itemName),
        16776960 -- yellow
    )
end)

Server Announcement Command

UniversalAdmin

An admin-only announcement sent to every player, with ox_lib notification and ace permission check. Useful template for any admin tooling.

Server Admin · Universal
-- server.lua
RegisterCommand('announce', function(source, args)
    if source ~= 0 and not IsPlayerAceAllowed(source, 'announce.use') then
        return TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'No permission.' } })
    end

    local message = table.concat(args, ' ')
    if message == '' then return end

    TriggerClientEvent('chat:addMessage', -1, {
        args = { '^3ANNOUNCEMENT', message }
    })
end, false)

-- client.lua (notifications via ox_lib for a nicer look)
RegisterNetEvent('announce:client:Show', function(message)
    lib.notify({
        title = 'Server Announcement',
        description = message,
        type = 'inform',
        position = 'top',
        duration = 8000
    })
end)

-- Add this to server.cfg:
-- add_ace group.admin announce.use allow
-- add_principal identifier.license:YOUR_LICENSE group.admin

Simple Fuel Consumption

StandaloneVehicleStarter

A lightweight standalone fuel system: fuel drains while the engine runs, refuel at a gas station marker. A perfect first "systems" script to learn from.

Vehicle · Standalone
-- client.lua
local FUEL_USE_PER_MIN = 1.2 -- units per minute at full throttle
local REFUEL_POINT = vector3(263.9, -342.5, 44.6) -- one gas station

CreateThread(function()
    while true do
        local sleep = 5000
        local ped = PlayerPedId()
        if IsPedInAnyVehicle(ped, false) then
            local veh = GetVehiclePedIsIn(ped, false)
            if GetPedInVehicleSeat(veh, -1) == ped then
                sleep = 1000
                local fuel = GetVehicleFuelLevel(veh)
                local rpm = GetVehicleCurrentRpm(veh)
                if fuel > 0 and rpm > 0.0 then
                    DecalRemoveRupture(veh)
                    SetVehicleFuelLevel(veh, math.max(0.0, fuel - (FUEL_USE_PER_MIN / 60) * (rpm + 0.2)))
                end
            end
        end
        Wait(sleep)
    end
end)

-- Refuel when stopped at the gas station
CreateThread(function()
    while true do
        local sleep = 1000
        local coords = GetEntityCoords(PlayerPedId())
        if #(coords - REFUEL_POINT) < 3 then
            sleep = 0
            if IsControlJustReleased(0, 38) then
                local veh = GetVehiclePedIsIn(PlayerPedId(), false)
                if veh ~= 0 then
                    SetVehicleFuelLevel(veh, 100.0)
                    lib.notify({ title = 'Vehicle refueled', type = 'success' })
                end
            end
        end
        Wait(sleep)
    end
end)

How to Install a FiveM Script

Never added a resource to a FiveM server before? Here is the complete process.

01

Create the Resource

Make a new folder in your server's resources directory, e.g. resources/[custom]/my-script, and add the script files shown on each card.

02

Declare Dependencies

Copy the fxmanifest.lua from the library first, then add the client/server files. Make sure ox_lib, oxmysql or qb-core are running before your resource.

03

Ensure & Restart

Add 'ensure my-script' to server.cfg after its dependencies, then type 'refresh' and 'restart my-script' in the server console. Test in game.

Script Library FAQ

Are these FiveM scripts really free?

Yes. Every script here is free to use on your own server, no attribution required. You can modify them however you like.

Which framework should my server use — ESX or QBCore?

ESX has the biggest collection of free resources and a huge community history. QBCore is newer with more modern defaults out of the box. If you are starting fresh, QBCore is a popular 2026 choice; if you want maximum compatibility with old resources, ESX Legacy. Scripts here cover both.

Are these scripts safe to run on a live server?

Yes — and unlike random scripts from forums, every payment and reward here is validated server-side, which is the FiveM security standard. Client-side code alone can be bypassed by cheaters; these templates show the right pattern.

What are ox_lib and oxmysql?

They are the two most common FiveM libraries: ox_lib provides modern menus, notifications and progress bars; oxmysql handles database queries. Both are free and most 2026 servers run them. Each script card lists what it needs.

The script I want is not here. What do I do?

Use our AI FiveM script generator. Describe the system — 'a hunting job with rare animal spawns and a license requirement' — and get a complete ESX or QBCore resource with comments in seconds.

Do these scripts work on RedM or GTA V story mode?

They are written for FiveM (GTA V multiplayer). RedM uses a similar Lua environment but different natives, so expect to adapt. They will not run in singleplayer GTA V.

Need a Custom FiveM System?

Describe the script in plain English and our AI writes the complete resource — client, server, config and all.

Generate Your Custom Script