Objects

Library
Updated a month ago · v1.3.7
i

Client Module - This can only be used on the client

lib.objects.register

Create a new object

lua
lib.objects.register(name, new_data)
Parameter TypeRequiredDescription
nameStringtrueUnique reference for object
new_dataObjecttrueOptions for the object, refer to Data Structure

lib.objects.get

Get information regarding an object

lua
local obj = lib.objects.get(name)
Parameter TypeRequiredDescription
idStringtrueUnique reference for the object

lib.objects.destroy

Completely remove an object

lua
lib.object.destroy(id)
Parameter TypeRequiredDescription
idStringtrueUnique reference for the object

Data Structure

This is the data structure of an object and the valid options

lua
{
    type = "ped",                 -- ped, vehicle, object, or weapon
    model = `a_f_m_bevhills_01`,  -- Model hash
    pos = vector4(0, 0, 0, 0),    -- Position (also accepts vector3)
    rotation = vector3(0, 0, 0),  -- Optional rotation
    renderDist = 50,              -- When to render the object
    freeze = true,                -- Freeze the entity in place
    collision = true,             -- Enable collision
    invincible = true,            -- Make entity invincible
    zone = {                      -- Optional: auto-spawn/despawn zone
        radius = 50,
        onEnter = function() end,
        onExit = function() end,
    },
    onSpawn = function(entity)    -- Called when entity spawns
    end,
    onDespawn = function(entity)  -- Called when entity despawns
    end,
}
Was this page helpful?
This page was last updated on 12 March 2026
DIRKSCRIPTS
All you need for your FiveM server.10% off your first order

Unsubscribe any time.

Copyright © 2026 DirkScripts. Not affiliated with or endorsed by Rockstar North or Take-Two Interactive.