# Exports (/docs/orbit-studios-resources/orbit-dynamichud-v2/exports)



# Exports [#exports]

Exports are called from another resource. Client exports affect only the local player; the server `toggleHud` export accepts a target player source.

## Client exports [#client-exports]

| Export               | Signature                         | Return             | Purpose                                                                                                                    |
| -------------------- | --------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `notify`             | `notify(data)`                    | none               | Show a notification.                                                                                                       |
| `Notify`             | `Notify(data)`                    | none               | Case-compatible alias of `notify`.                                                                                         |
| `showTextUI`         | `showTextUI(text, options?)`      | none               | Show or replace the local Text UI prompt.                                                                                  |
| `hideTextUI`         | `hideTextUI()`                    | none               | Hide Text UI.                                                                                                              |
| `isTextUIOpen`       | `isTextUIOpen()`                  | `boolean, string?` | Return open state and current text.                                                                                        |
| `skillCheck`         | `skillCheck(difficulty, inputs?)` | `boolean`          | Run a blocking skill check.                                                                                                |
| `skillCheckActive`   | `skillCheckActive()`              | `boolean`          | Test whether a skill check is active.                                                                                      |
| `cancelSkillCheck`   | `cancelSkillCheck()`              | none               | Cancel the active skill check.                                                                                             |
| `progressBar`        | `progressBar(data)`               | `boolean`          | Run a blocking progress action.                                                                                            |
| `progressActive`     | `progressActive()`                | `boolean`          | Test whether a progress bar is active.                                                                                     |
| `cancelProgress`     | `cancelProgress()`                | none               | Force-cancel the active progress bar.                                                                                      |
| `SeatbeltState`      | `SeatbeltState(state)`            | none               | Set the local speedometer seatbelt indicator.                                                                              |
| `CruiseControlState` | `CruiseControlState(state)`       | none               | Set the local speedometer cruise indicator.                                                                                |
| `toggleHud`          | `toggleHud(visible)`              | none               | Ask the server to replicate HUD visibility for the local player.                                                           |
| `getHudVisibility`   | `getHudVisibility()`              | `boolean`          | Return whether the gameplay HUD is currently visible after temporary visibility gates are applied.                         |
| `getOnboardingState` | `getOnboardingState()`            | `boolean`          | Return the current local onboarding state.                                                                                 |
| `startOnboarding`    | `startOnboarding()`               | `boolean`          | Request incomplete onboarding to start. Returns whether the request passed the client-side configuration and login guards. |
| `closeOnboarding`    | `closeOnboarding()`               | `boolean`          | Close onboarding and return whether an active or pending onboarding state existed.                                         |

Detailed option tables and examples for the first eleven exports are in [Interface APIs](/docs/orbit-studios-resources/orbit-dynamichud-v2/interface).

```lua title="resources/[custom]/client/main.lua"
exports['orbit-dynamichud-v2']:notify({
    description = 'Saved successfully.',
    type = 'success'
})

exports['orbit-dynamichud-v2']:showTextUI('[E] Interact')

local passed = exports['orbit-dynamichud-v2']:skillCheck('easy', { 'E' })
local completed = exports['orbit-dynamichud-v2']:progressBar({
    label = 'Working',
    duration = 3000
})

exports['orbit-dynamichud-v2']:hideTextUI()
```

## Vehicle state exports [#vehicle-state-exports]

Use the state bags described on the [Events and State Bags](/docs/orbit-studios-resources/orbit-dynamichud-v2/events#state-bags) page when your resource already owns replicated vehicle/player state. The exports are useful for older client-only integrations.

```lua title="resources/[custom]/client/seatbelt.lua"
exports['orbit-dynamichud-v2']:SeatbeltState(true)
exports['orbit-dynamichud-v2']:CruiseControlState(false)
```

`SeatbeltState` expects a truthy or false value. `CruiseControlState` forwards the supplied value to the UI. Call them only when state changes rather than every frame.

## HUD visibility [#hud-visibility]

The client export emits a source-bound server event that updates the calling player's replicated `hud:showHud` state:

```lua title="resources/[custom]/client/main.lua"
exports['orbit-dynamichud-v2']:toggleHud(false)

-- Show it again later.
exports['orbit-dynamichud-v2']:toggleHud(true)
```

Read the effective local visibility state when another resource needs to coordinate its own interface:

```lua title="resources/[custom]/client/main.lua"
local hudVisible = exports['orbit-dynamichud-v2']:getHudVisibility()

if hudVisible then
    -- The gameplay HUD is currently being rendered.
end
```

This getter includes temporary visibility gates such as onboarding and game-menu state. It does not change the replicated `hud:showHud` value.

The server export accepts a player source first:

```lua title="resources/[custom]/server/main.lua"
exports['orbit-dynamichud-v2']:toggleHud(source, false)
```

## Server exports [#server-exports]

| Export      | Signature                    | Return | Purpose                                                             |
| ----------- | ---------------------------- | ------ | ------------------------------------------------------------------- |
| `toggleHud` | `toggleHud(source, visible)` | none   | Set `Player(source).state['hud:showHud']` with replication enabled. |

Validate the target source in network-facing code before calling the server export. Do not accept an arbitrary target from an untrusted client event without permission checks.

## Onboarding state and controls [#onboarding-state-and-controls]

Use the client exports when another local resource needs direct onboarding control:

```lua title="resources/[custom]/client/main.lua"
local onboardingState = exports['orbit-dynamichud-v2']:getOnboardingState()

if onboardingState then
    local requested = exports['orbit-dynamichud-v2']:startOnboarding()
    print(('Onboarding request accepted: %s'):format(requested))
end

-- Close the flow when an external setup or character flow takes over.
exports['orbit-dynamichud-v2']:closeOnboarding()
```

`startOnboarding` is non-forcing: it follows `Config.Onboarding`, `Config.SettingsLocked`, player-login, and completed-state guards. It does not reopen onboarding for a player who already completed it. `closeOnboarding` synchronizes the NUI state and releases onboarding focus without closing an unrelated HUD interface.

See [Onboarding](/docs/orbit-studios-resources/orbit-dynamichud-v2/onboarding) for automatic/manual modes and [Events and State Bags](/docs/orbit-studios-resources/orbit-dynamichud-v2/events#trigger-and-close-onboarding) for event-based integrations.

## Resource-stop cleanup [#resource-stop-cleanup]

Resources that show Text UI should hide it from their client `onResourceStop` handler. Cancel a skill check or progress bar only if your resource started it and still owns the active flow.

```lua title="resources/[custom]/client/main.lua"
AddEventHandler('onResourceStop', function(resourceName)
    if resourceName ~= GetCurrentResourceName() then return end

    exports['orbit-dynamichud-v2']:hideTextUI()

    if exports['orbit-dynamichud-v2']:skillCheckActive() then
        exports['orbit-dynamichud-v2']:cancelSkillCheck()
    end

    if exports['orbit-dynamichud-v2']:progressActive() then
        exports['orbit-dynamichud-v2']:cancelProgress()
    end
end)
```
