# getRoadDensity (Client)

> Measures how much road there is around a point: the lanes times the length of the car links starting within 80 m of it, scaled down.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Roads and paths
- **URL**: https://wiki.mymp.gg/en/getRoadDensity

## Syntax

```lua
float getRoadDensity(float x, y)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x, y` | `float` | The point on the map. |

## Returns

The density, 0 when there are no loaded roads nearby.

## Example

```lua
local position = getElementPosition(localPlayer)
if getRoadDensity(position.x, position.y) < 0.1 then
    outputDebugString("you are far from any road")
end
```

### Note

Only nodes in loaded path areas count: those near the player, or requested with `requestPathNodesInArea`.

## See also

- [getPathNodesInRadius (Client)](https://wiki.mymp.gg/en/getPathNodesInRadius.md): Lists the road or footpath nodes within a radius.
- [getSafePedSpawnPosition (Client)](https://wiki.mymp.gg/en/getSafePedSpawnPosition.md): Picks a random spot on a footpath near a point where a ped can appear, the way SA chooses where to create peds. The spot is on the ground.
