ox_target for FiveM: what it is, common mistakes and the AI skill

View on skills.sh

Updated

Don’t want to manage skills yourself? Get the full app.

ox_target is the third-eye targeting resource for FiveM. You add interaction options to entities, models, players and zones through exports.ox_target. This guide covers the API, the mistakes that open exploits and the AI skill that avoids them.

ox_target is the third-eye targeting resource for FiveM. It replaces qb-target and bt-target and supports ox_core, ESX and qbx_core. You add options to entities, models, players and zones, and the player selects them with the target key. Every function is called through exports.ox_target:<fn>(...), because there is no global ox_target table.

Quick reference

Every function is exports.ox_target:<name>(...) and runs on the client. Each takes an array of option tables.

Export Use it for
addLocalEntity(entity, options) An entity you spawned locally
addEntity(netId, options) A networked entity
addModel(models, options) Every instance of a model
addGlobalPed / addGlobalVehicle / addGlobalObject / addGlobalPlayer A whole category
addGlobalOption(options) Everything, no filter
addBoxZone / addSphereZone / addPolyZone A place instead of an entity; returns a zone id
removeZone(zoneId) Remove a zone

Common option fields: label, name, icon, distance, groups, items, canInteract, onSelect, serverEvent. Set name on any option you plan to remove.

What the ox_target skill gives you

The skill maps each target to the right function:

  • addLocalEntity for an entity you spawned locally and addEntity for a networked entity.
  • addModel for every instance of a model.
  • addGlobalPed, addGlobalVehicle, addGlobalObject and addGlobalPlayer for whole categories, and addGlobalOption for everything.
  • addBoxZone, addSphereZone and addPolyZone for a location instead of an entity.

Rule files cover setup, every field of the option table, entities, zones and the migration from qb-target. The upstream reference is overextended.dev/ox_target.

Common mistakes with ox_target

  • Trusting onSelect. It runs on the client. Route anything that grants money, items or state through serverEvent and validate again in the server handler.
  • Using qb-target syntax. The option format is different. Build the options array from the documented fields.
  • Forgetting the option name. Options are removed by name, not by index. Pass name on every option you plan to remove.
  • Leaving distance to the default. Set distance explicitly for anything beyond about 2.5 m.
  • Checking conditions inside onSelect. Gate visibility with groups, items or canInteract so players do not see options they cannot use.
  • Calling zone functions on the server. Zone and entity functions are client side only.
  • Starting ox_target before ox_lib. Make sure ox_lib starts first in server.cfg.

Why AI assistants get ox_target wrong

Many examples online use qb-target, so assistants often emit exports['qb-target'] calls or invent a global table. Both fail on ox_target. Assistants also tend to put the reward logic inside onSelect, which leaves the server open to spoofed events.

The ox_target skill lists the real functions and the decision table for choosing one. The assistant reads the rule that matches your request and writes exports.ox_target code with serverEvent for anything that changes state.

To see how a skill compares with other FiveM AI setups, read our comparison.

Install the ox_target skill in 30 seconds

  1. Click "Download SKILL.md" at the top of this page.
  2. Unzip it into the skills or rules folder of your AI tool. The install section below shows the exact path for Claude Code, Cursor and VS Code.
  3. Ask the assistant for something concrete, like "add a third-eye option to a ped that opens a shop", and check that it uses exports.ox_target:addLocalEntity and handles the purchase in a serverEvent.

How to install this skill

Download the zip, unzip it, and place the folder where your tool loads skills or rules. The exact path depends on the tool:

Claude Code

Unzip into .claude/skills/ox-target/ inside the project (the folder must contain SKILL.md). For every project, use ~/.claude/skills/ox-target/ instead.

Claude Code skills docs

Cursor

Cursor loads project rules from .cursor/rules/. Add a rule file there that points to the unzipped skill, or paste the contents of SKILL.md and the rule files into a rule. The format is .mdc with frontmatter and changes between versions, so check the docs for your version.

Cursor rules docs

VS Code / Copilot

Copilot reads instruction files from .github/instructions/*.instructions.md. Copy SKILL.md there with an applyTo glob for your Lua files, and keep the rule files next to it.

VS Code custom instructions docs

The SKILL.md file

This is the file your AI assistant reads. It links to the rule files bundled in the download.

Skill contents (includes SKILL.md and any other files)

ox_target

Third-eye targeting for FiveM. Replaces qb-target and bt-target. Supports ox_core, esx and qbx_core.

Activation Contract

Load this skill when the user asks to make something interactable: "press E on this ped", "third eye", "target option", "add an interaction to this vehicle/door/prop", or when migrating from qb-target.

Hard Rules

  • Call every function through exports.ox_target:<fn>(...). There is no global ox_target table.
  • onSelect runs on the CLIENT. Never trust its arguments server-side: re-validate in the serverEvent handler.
  • Always pass name on an option you intend to remove later. Removal is by name, not by index.
  • distance defaults to the resource default; set it explicitly for anything above ~2.5m.
  • Zone and entity functions are CLIENT-side only.
  • Prefer addLocalEntity for entities you spawned yourself; use addEntity only for networked entities and expect the id to change on respawn.

Decision Gates

Target Function
One entity you spawned locally addLocalEntity(entities, options)
A networked entity (net id) addEntity(entities, options)
Every instance of a model addModel(models, options)
Every ped / vehicle / object / player addGlobalPed / addGlobalVehicle / addGlobalObject / addGlobalPlayer
Everything, no filter addGlobalOption(options)
A location, not an entity addBoxZone / addSphereZone / addPolyZone

Execution Steps

  1. Confirm ox_target is started AFTER ox_lib in server.cfg.
  2. Pick the function from the Decision Gates table.
  3. Build the options array. Read rules/options.md for every allowed field.
  4. Gate visibility with groups, items or canInteract rather than checking inside onSelect.
  5. Route the action: onSelect for client logic, serverEvent for anything that grants money, items or state.
  6. Store the returned zone id if the zone must be removed later.

Output Contract

Return runnable Lua using exports.ox_target. Include the fxmanifest.lua dependency lines when the resource is new. Never emit qb-target syntax.

References

  • rules/setup.md — install, fxmanifest, convars, framework support.
  • rules/options.md — every field of the option table.
  • rules/entities.md — entity, model and global targets.
  • rules/zones.md — box, sphere and poly zones.
  • rules/migration.md — qb-target to ox_target.

Upstream docs: https://overextended.dev/ox_target

Frequently asked questions

Does ox_target replace qb-target?
Yes. ox_target replaces qb-target and bt-target, and the skill includes a migration rule for qb-target. The option format differs, so do not paste qb-target syntax.
Is ox_target free?
Yes. ox_target is open source and published on GitHub by the Overextended and CommunityOx teams, so you can use it on any server at no cost.
Is it safe to give items from onSelect?
No. onSelect runs on the client, so its arguments cannot be trusted. Use serverEvent for anything that grants money, items or state, and validate again in the server handler.

Longer reads from the FiveAI blog on the same topic.

More skills