Runtime attachment exports let other resources toggle a player's manual attachments or loadout groups — and temporarily hide or show their body attachments — without a script restart or config edit. Changes are per-player and pushed to the client immediately on call.
Exports come in two flavours:
source id, and forward the change to that player's client.Client exports are called with exports['onex-bodyAttachments']:<name>(...) from client scripts. Server exports use the same syntax from server scripts, with the target player's src as the first argument.
Toggles a single manual object on or off for the local player.
Syntaxlocal state = exports['onex-bodyAttachments']:toggleObject(objectId, state)
| Argument | Type | Description |
|---|---|---|
objectId | string | ID of the object (the key in the objects definitions table, e.g. "revolver"). Only objects whose type is "manual" respond — weapon/item objects are driven by ownership, not toggles. |
state | boolean | Optional. true = on, false = off. Omit or pass nil to flip the current state. |
true -- object is now active false -- object is now inactive
Your Script-- Force a manual holster prop on exports['onex-bodyAttachments']:toggleObject("dutybelt_radio", true) -- Flip it back off later exports['onex-bodyAttachments']:toggleObject("dutybelt_radio")
Toggles every manual member of a loadout group together (e.g. a full duty belt).
Syntaxlocal state = exports['onex-bodyAttachments']:toggleGroup(groupId, state)
| Argument | Type | Description |
|---|---|---|
groupId | string | ID of a group defined in the groups definitions table. A group holds members = { objectId, ... }. |
state | boolean | Optional. Forces every manual member on/off. Omit or pass nil to flip based on the first member's current state. |
true -- group turned on false -- group turned off, OR group does not exist / has no members
Your Script-- Turn the whole police belt on exports['onex-bodyAttachments']:toggleGroup("police_belt", true) -- Flip the whole belt off exports['onex-bodyAttachments']:toggleGroup("police_belt")
Temporarily suppresses every attachment on the local player. Session-only — not persisted.
Syntaxexports['onex-bodyAttachments']:hideAllAttachments()
None.
None. This is a fire-and-forget visibility override.
Your Script-- Hide everything before a cutscene / strip search / minigame exports['onex-bodyAttachments']:hideAllAttachments()
Clears the "hide all" override and any per-object temp hides, restoring the player's attachments.
Syntaxexports['onex-bodyAttachments']:showAllAttachments()
None.
None.
Your Script-- Restore everything after the cutscene ends exports['onex-bodyAttachments']:showAllAttachments()
Temporarily hides or shows a single attachment. Session-only per-object override, independent of the persisted eye-toggle.
Syntaxlocal hidden = exports['onex-bodyAttachments']:setAttachmentHidden(objectId, hidden)
| Argument | Type | Description |
|---|---|---|
objectId | string | ID of the object to hide/show. |
hidden | boolean | Optional. true = hide, false = show. Omit or pass nil to flip the current state. |
true -- object is now hidden false -- object is now shown, OR objectId was not a string
Your Script-- Hide just the revolver exports['onex-bodyAttachments']:setAttachmentHidden("revolver", true) -- Toggle it back exports['onex-bodyAttachments']:setAttachmentHidden("revolver")
Server exports mirror the temp hide/show client exports, but target a player by their server id. They are dispatched to that player's client immediately.
Suppresses every attachment on a target player.
Syntaxlocal ok = exports['onex-bodyAttachments']:hideAllAttachments(source)
| Argument | Type | Description |
|---|---|---|
source | number | Server ID of the target player. |
true -- dispatched to the player's client false -- source was invalid
Your Scriptexports['onex-bodyAttachments']:hideAllAttachments(source)
Restores all attachments on a target player (clears "hide all" and per-object temp hides).
Syntaxlocal ok = exports['onex-bodyAttachments']:showAllAttachments(source)
| Argument | Type | Description |
|---|---|---|
source | number | Server ID of the target player. |
true -- dispatched to the player's client false -- source was invalid
Your Scriptexports['onex-bodyAttachments']:showAllAttachments(source)
Hides or shows a single attachment on a target player.
Syntaxlocal ok = exports['onex-bodyAttachments']:setAttachmentHidden(source, objectId, hidden)
| Argument | Type | Description |
|---|---|---|
source | number | Server ID of the target player. |
objectId | string | ID of the object to hide/show. |
hidden | boolean | true = hide, false = show. |
true -- dispatched to the player's client false -- source was invalid, or objectId was not a string
Your Scriptexports['onex-bodyAttachments']:setAttachmentHidden(source, "revolver", true)
Toggles are manual-only. toggleObject and toggleGroup only affect objects whose type is "manual". Weapon and item attachments render from ownership and cannot be forced on with these exports.
Temp hide/show is session-only. Hide/show state (both "hide all" and per-object) is stored in memory and is automatically cleared on resource restart or when the player rejoins. Re-apply it on player load if you need it to persist across sessions. Server exports are fire-and-forget — the return value reports that the change was dispatched, not that the client has applied it.
| Scenario | How |
|---|---|
| Cutscenes & strip searches | Call hideAllAttachments before the scene and showAllAttachments after to cleanly remove all body props. |
| Prison / jail intake | Server-side, hide a specific player's weapons and gear with setAttachmentHidden(src, ...) while they're processed, then restore on release. |
| Minigames & arenas | Normalise appearance by hiding everyone's attachments for a fair deathmatch or shooting-range session. |
| Gunsmith & loadout menus | Toggle manual holster/belt props live with toggleObject / toggleGroup as the player equips or removes gear. |
| Admin / staff tooling | Force-hide or reveal a reported player's attachments remotely with the server exports for moderation or debugging. |
Assignments are stored in memory only and are automatically cleared when the player drops. Re-apply them on player join if persistence across sessions is required.
Last updated about 5 hours ago