---
name: "roadsConnectedTo"
type: command
status: ok
groups: ["Roads and Airports"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/roadsConnectedTo
revid: 369200
updated: 2024-09-03T10:34:49Z
---

# roadsConnectedTo

*Command · Roads and Airports · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

Find the road segments connected to the given road segment.

> [!IMPORTANT]
> - Pedestrian roads such as `"TRAIL"`s are missing connection information by design, therefore the primary syntax will return empty array for those - use the alternative syntax to return pedestrian roads.
> - Road connection is not bidirectional; e.g road segment Y can be connected to road segment Z, but road segment Z can lack a connection with road segment Y.

## Syntax

### Syntax 1

```sqf
roadsConnectedTo roadSegment
```

**Parameters:**

- `roadSegment`: [Object](../topics/Object.md) - road segment

**Returns:** [Array](../topics/Array.md) of [Object](../topics/Object.md)s - connected road segments

### Syntax 2

*since arma3 2.00*

```sqf
roadsConnectedTo [roadSegment, extended]
```

**Parameters:**

- `roadSegment`: [Object](../topics/Object.md) - road segment
- `extended`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) when [true](../commands/true.md), performs a more thorough search on top of base behaviour, slower but returns pedestrian and other missing road segments

**Returns:** [Array](../topics/Array.md) of [Object](../topics/Object.md)s - connected road segments

## Examples

### Example 1

```sqf
_road = (player nearRoads 50) select 0;
_connectedRoads = roadsConnectedTo _road;
```

### Example 2

```sqf
_road = (player nearRoads 50) select 0;
_connectedRoadsIncPedestrian = roadsConnectedTo [_road, true];
```

## See also

[nearRoads](../commands/nearRoads.md) · [isOnRoad](../commands/isOnRoad.md) · [roadAt](../commands/roadAt.md) · [surfaceIsWater](../commands/surfaceIsWater.md) · [getRoadInfo](../commands/getRoadInfo.md) · [nearestTerrainObjects](../commands/nearestTerrainObjects.md)

<sub>Source: [BI Community Wiki — roadsConnectedTo](https://community.bistudio.com/wiki/roadsConnectedTo) (revision 369200).</sub>
