> For the complete documentation index, see [llms.txt](https://errorhub.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://errorhub.gitbook.io/docs/our-scripts/advanced-cutscene/configuration/qb-apartment.md).

# QB-Apartment

If you're using [qb-apartments](https://github.com/qbcore-framework/qb-apartments) with the starting apartment enabled (i.e., `Apartments.Starting` is set to `true` in `qb-apartments/config`), you must follow these steps. Otherwise, you can skip this setup:

1. Open the <mark style="color:yellow;">`main.lua`</mark> file in the <mark style="color:yellow;">`qb-apartments/client`</mark> folder.
2. Insert the following code at the bottom of the <mark style="color:yellow;">`main.lua`</mark> file:

```lua
RegisterNetEvent("eh_cutscene:client:resetApartment", function()
    if not InApartment then return end
    TriggerServerEvent('qb-apartments:returnBucket')
    exports['qb-interior']:DespawnInterior(HouseObj, function()
        TriggerEvent('qb-weathersync:client:EnableSync')
        Wait(1000)
        TriggerServerEvent('apartments:server:RemoveObject', CurrentApartment, ClosestHouse)
        TriggerServerEvent('qb-apartments:server:SetInsideMeta', CurrentApartment, false)
        CurrentApartment = nil
        InApartment = false
        CurrentOffset = 0
        TriggerServerEvent('apartments:server:setCurrentApartment', nil)
        DeleteInApartmentTargets()
        DeleteApartmentsEntranceTargets()
    end)
end)
```

3. Open the <mark style="color:yellow;">`open.lua`</mark> file in the <mark style="color:yellow;">`eh_cutscene/config`</mark> folder.
4. Search for the function `cutscene.onStarted()` on line 1, then find and uncomment lines 8-9 (approx). Your function should look somewhat like the example below—just remove the `--` from lines 8 and 9 to enable them.

<figure><img src="https://1729625470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxidMK8qrj6xNWG2yJTsI%2Fuploads%2Fgc82AgOXgjORS3yOJh0b%2Fimage.png?alt=media&amp;token=84a9972a-55e4-4057-933f-92a94b4d82c7" alt=""><figcaption></figcaption></figure>
