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

# Get closest door

> Get the closest active door to the player.

Returns the closest **active** door to the player.

```lua Export theme={null}
exports["doors_creator"]:getClosestActiveDoor()
```

### Return

| Name       | Data Type | Description                                  |
| ---------- | --------- | -------------------------------------------- |
| `door`     | table     | Table containing `door.id` and `door.object` |
| `distance` | float     | Distance from the door                       |

## Example

```lua theme={null}
Citizen.CreateThread(function()
    local closestDoor, closestDist = exports["doors_creator"]:getClosestActiveDoor()

    if(closestDoor and closestDist < 3.0) then
        print("The closest door is " .. closestDoor.id .. " and is " .. closestDist .. " meters away")
    end
end)
```


## Related topics

- [Client](/doors-creator/client/index.md)
- [Get all doors list](/doors-creator/server/get-all-doors-list.md)
- [Get door ID data](/doors-creator/server/get-door-id-data.md)
- [Get door ID from entity](/doors-creator/client/get-door-id-from-entity.md)
- [Toggle closest vehicle lock](/vehicles-keys/client/toggle-closest-vehicle-lock.md)
