> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set door ID state (locked/unlocked)

> Lock or unlock a door server side by its ID.

```lua Export theme={null}
exports["doors_creator"]:setDoorState(doorId, state)
```

### Parameters

| Name     | Data Type | Description                                    |
| -------- | --------- | ---------------------------------------------- |
| `doorId` | integer   | The door ID                                    |
| `state`  | integer   | The door's new state. 1 = locked, 0 = unlocked |

## Example

```lua theme={null}
Citizen.CreateThread(function()
    local doors = exports["doors_creator"]:getAllDoors()

    -- This will close ALL the doors
    for k, doorData in pairs(doors) do
        exports["doors_creator"]:setDoorState(doorData.id, 1)
    end
end)
```


## Related topics

- [Vehicle locked/unlocked](/vehicles-keys/client/vehicle-locked-unlocked.md)
- [Create door](/doors-creator/server/create-door.md)
- [Update door](/doors-creator/server/update-door.md)
- [Server](/vehicles-keys/server/index.md)
