> ## Documentation Index
> Fetch the complete documentation index at: https://zyra-store.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Client exports

**Client exports** allow you to call functions exposed by Zyra Store scripts directly from other resources on your FiveM server. In Lua, the standard syntax for invoking an export is as follows:

```lua theme={null}
exports['resource-name']:FunctionName(args)
```

Replace `resource-name` with the exact name of the Zyra Store resource (for example, `zyra-mi-script`) and `FunctionName` with the name of the function you want to invoke. All client exports must be called only from client-side scripts (`client.lua`).

***

## GetPlayerData()

Returns a table with the current local player's data. Use this function to access character information without needing to make a request to the server.

**Parameters** `none`

This function receives no parameters.

**Returns** `table`

A table with the following fields:

| Field | Type | Description |
| - | - | - |
| `name` | string | Player character name |
| `identifier` | string | Unique identifier (license, etc) |
| `job` | string | Player's current job |
| `grade` | number | Rank within the current job |

```lua other-resource/client.lua theme={null}
local data = exports['zyra-mi-script']:GetPlayerData()
print('Name:', data.name)
print('Job:', data.job, '| Rank:', data.grade)
```

> [!TIP]
>
> If you need to access player data frequently (for example, on every frame or in multiple functions), save the result in a local variable to avoid repeated export calls. Update that variable only when the data may have changed, such as when receiving a server event.

***

## OpenMenu(menuId)

Opens a specific script menu identified by its ID. Returns `true` if the menu opened correctly, or `false` if the ID does not exist or the menu is already open.

**menuId** `string` *required*

The identifier of the menu you want to open. Accepted values: `'main'`, `'admin'`, `'settings'`.

**Returns** `boolean`

`true` if the menu opened successfully; `false` otherwise.

```lua other-resource/client.lua theme={null}
local success = exports['zyra-mi-script']:OpenMenu('main')
if not success then
    print('Could not open the menu.')
end
```

***

## CloseMenu()

Closes whichever menu is currently open. If there is no active menu, the call has no effect.

**Parameters** `none`

This function receives no parameters.

**Returns** `nil`

This function returns no value.

```lua other-resource/client.lua theme={null}
-- Close the active menu (if any)
exports['zyra-mi-script']:CloseMenu()
```

***

## TriggerCallback(name, cb, ...)

Triggers a server-side callback and delivers the result back to the client through the `cb` function. You can pass additional arguments after the callback to send them to the server.

**name** `string` *required*

The name of the callback registered on the server (for example, `'zyra:getServerData'`).

**cb** `function` *required*

The function that will execute when the server responds. Receives the returned data as an argument.

**...** `any`

Additional optional arguments that will be sent to the server along with the callback request.

```lua other-resource/client.lua theme={null}
exports['zyra-mi-script']:TriggerCallback('zyra:getServerData', function(data)
    print('Server data:', json.encode(data))
end, 'optional-extra-arg')
```

***

## IsReady()

Returns `true` if the script has finished initializing and is ready to operate. Useful for avoiding calls to other exports before the resource has fully loaded.

**Parameters** `none`

This function receives no parameters.

**Returns** `boolean`

`true` if the script is initialized and ready; `false` if it is still loading.

```lua other-resource/client.lua theme={null}
-- Wait for the script to be ready before continuing
while not exports['zyra-mi-script']:IsReady() do
    Wait(500)
end
print('The script is ready.')
```

***

## GetLocale(key)

Returns the localized text string corresponding to the provided key, according to the language configured in the script. If the key does not exist, the key itself is returned as a fallback.

**key** `string` *required*

The localization key defined in the script's `locales/*.lua` files (for example, `'notify_success'`).

**Returns** `string`

The translated text in the active language, or the key itself if no translation is found.

```lua other-resource/client.lua theme={null}
local msg = exports['zyra-mi-script']:GetLocale('notify_success')
print(msg) -- 'Action completed successfully.'
```

***

To see the exports available on the server side, visit the [server exports reference](https://zyra-store.mintlify.site/en/reference/exports/server-exports.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.