> For the complete documentation index, see [llms.txt](https://gley.gitbook.io/mobile-traffic-system/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gley.gitbook.io/mobile-traffic-system/complete-api/setintersectionroadtogreen.md).

# SetIntersectionRoadToGreen

### Description

Force a road from a traffic light intersection to change to green.

### Declaration&#x20;

```csharp
public static void SetIntersectionRoadToGreen(string intersectionName, int roadIndex, bool doNotChangeAgain = false)
```

### Parameters

<table><thead><tr><th width="198">Name</th><th>Description</th></tr></thead><tbody><tr><td><strong>intersectionName</strong></td><td>Name of the intersection to change.</td></tr><tr><td><strong>roadIndex</strong></td><td>The road index to change.</td></tr><tr><td><strong>doNotChangeAgain</strong></td><td>If true that road will stay green until this parameter is set back to false.</td></tr></tbody></table>

### Example

```csharp
using Gley.TrafficSystem;
using UnityEngine;
public class Test : MonoBehaviour
{
    //a reference to vehicle pool and player assigned in inspector
    public VehiclePool vehiclePool;
    public Transform player;

    void Start()
    {
        API.Initialize(player, 20, vehiclePool);
    }

    public void SetRoadToGreen()
    {
        //change the road 0 of Intersection_2 to green and keep it green.
        API.SetIntersectionRoadToGreen("Intersection_2", 0, true);
    }
}

```
