# 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
```
