> For the complete documentation index, see [llms.txt](https://mz-studio.gitbook.io/muziscripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mz-studio.gitbook.io/muziscripts.com/loadingscreen/installation.md).

# Installation

{% tabs %}
{% tab title="ZSX\_Multicharacter" %}

* ZSX\_Multicharacter natively supports waiting for the loading screen to be closed manually. You only need to toggle the config option:

```lua
Config.AwaitShutdownLoadingScreen = true
```

{% endtab %}

{% tab title="qb-multicharacter" %}
Open the default Cfx resource file:\
\[cfx-default]\[managers]\spawnmanager\spawnmanager.lua

Locate the function spawnPlayer(spawnIdx, cb) (around line 314) and comment out the following line:

```lua
-- ShutdownLoadingScreen()
```

Open qb-multicharacter\client.lua, locate local function openCharMenu(bool), and replace it entirely with the following code:

```lua
local function openCharMenu(bool)
    QBCore.Functions.TriggerCallback('qb-multicharacter:server:GetNumberOfCharacters', function(result, countries)
        local translations = {}
        for k in pairs(Lang.fallback and Lang.fallback.phrases or Lang.phrases) do
            if k:sub(0, ('ui.'):len()) then
                translations[k:sub(('ui.'):len() + 1)] = Lang:t(k)
            end
        end
        if bool then
            while GetIsLoadingScreenActive() do
                Wait(10)
            end
            DoScreenFadeOut(0)
        end
        DoScreenFadeOut(0)
        SetNuiFocus(bool, bool)
        SendNUIMessage({
            action = 'ui',
            customNationality = Config.customNationality,
            toggle = bool,
            nChar = result,
            enableDeleteButton = Config.EnableDeleteButton,
            translations = translations,
            countries = countries,
        })
        skyCam(bool)
    end)
end
```

{% endtab %}

{% tab title="Other Multicharacter Frameworks" %}
If you are using any other multicharacter scripts, follow these generic steps:

Search through your multicharacter files and delete (or comment out) the following native functions:

\
`ShutdownLoadingScreen()`\
`ShutdownLoadingScreenNui()` <br>

Replace them with this optimized loop logic:

```
while GetIsLoadingScreenActive() do
    Wait(10) 
end
DoScreenFadeOut(0)
```

⚠️ Note for Escrowed / Encrypted Scripts:\
If you are using an escrow-protected or encrypted multicharacter resource and cannot find or modify ShutdownLoadingScreen(), please contact the original author of that resource for assistance.

{% endtab %}
{% endtabs %}
