Light won't create when I enter a trigger

I created a script to create a light source to create a different atmosphere. My script is in java

public var type: LightType;

function onTriggerEnter () {
	var lightGameObject : GameObject = new GameObject("The Light");

	lightGameObject.AddComponent(Light);
	

	lightGameObject.transform.position = Vector3(387.07, 204.4, -11.7);
}

You could try this:

var lightsource : Transform;

function Start () {
     lightsource.gameobject.active = false;
}

function onTriggerEnter () {
     lightsource.gameobject.active = true;
}

Just set up your light source beforehand, and drag it into the Transform box in the script.