# Spawnselector / Spawn

## ESX Spawnselector Integration

{% hint style="info" %}
When you do not integrate spawnselector in ESX, you are automatically spawned in the last position.
{% endhint %}

To activate the Spawnselector, find the function below and follow the steps.

```lua
Config.SpawnSelector = function()
    -- ONLY USE FOR ESX FRAMEWORKS
    -- You can spawn the character selector with export or trigger here
    -- if you put the export or trigger please change return value to true
    
    TriggerEvent('your-spawnselector-trigger-here')
    exports['your-script']:openUI()
    return true
end
```

{% hint style="info" %}
**When you put an&#x20;**<mark style="background-color:orange;">**export or event**</mark>**, you should&#x20;**<mark style="background-color:orange;">**return true**</mark>**.**
{% endhint %}

{% hint style="danger" %}
**When you delete the&#x20;**<mark style="background-color:orange;">**Export or Event**</mark>**, you have to&#x20;**<mark style="background-color:orange;">**return false**</mark>**&#x20;again. Please note that**
{% endhint %}

***

## QBCore Spawnselector Integration

{% hint style="info" %}
If you are using qb-apartment and qb-spawn, the script will automatically bring the spawnselector to your screen.
{% endhint %}

{% hint style="warning" %}
If you are using a different script, if it is available in qb-apartment events, it will open automatically. You can detect it by trial and error.
{% endhint %}

To activate the Spawnselector, find the function below and follow the steps.

```lua
Config.CharacterSelected = function(charid, skinData)
    -- When a person selects a character and presses the play button, the selected character comes as citizenid or char1...5
    -- You can spawn the character selector with export or trigger here. 
    -- skinData = {model = charModel, skin = charSkin}

    -- THESE PLACES ARE ACTUALLY FULL OF CODES

    -- THESE PLACES ARE ACTUALLY FULL OF CODES

    TriggerEvent('your-spawnselector-trigger-here')
    exports['your-script']:openUI()
end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/wais-resoucres/wais-multicharacterv2/spawnselector-spawn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
