Problem with a Light Swich script!

I’m trying to make a script for a light swich so I can turn the light on / off ,but I don’t know where I’m mistaking! The swich has a colider that’s trigged,beacose I want to display a text when you are close to the swich, to show you the key that needs to be presed by you to swich the light. Thank you verry much for the time spend to fix my problem.

/script

using UnityEngine;
using System.Collections;

public class SwichLight : MonoBehaviour {
public bool InTrigger;
public bool LightState;

void Update()
{
    if (InTrigger)
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            (GetComponent<Light>().enabled = true);
            LightState = true;
        }
    }
    else
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            LightState = false;
            (GetComponent<Light>().enabled = false);
        }
    }
}

void OnGUI()
{
    if (LightState)
    {
        GUI.Box(new Rect(0, 60, 200, 25), "Press E to swich off the light");
    }
    else
    {
        GUI.Box(new Rect(0, 60, 200, 25), "Press E to swich on the light!");
    }
}

void OnTriggerEnter(Collider other)
{
    inTrigger = true;
}

void OnTriggerExit(Collider other)
{
    InTrigger = false;
}

}

In the OnTriggerEnter() method there appears to be a typo error in the variable name. The assignment should be:

  InTrigger = true;

Noticed a few other things. The Update() loop needs to check for both the trigger and the current state of the light switch. The following code changes gui text while inside the trigger and toggles the switch using the E key.

    public bool InTrigger;
    public bool LightState;

    void Update()
    {
        if (InTrigger)
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                if (LightState)
                {
                    LightState = false;
                    GetComponent<Light>().enabled = false;
                }
                else
                {
                    GetComponent<Light>().enabled = true;
                    LightState = true;
                }
            }
        }
    }

    void OnGUI()
    {
        if (InTrigger)
        {
            if (LightState)
            {
                GUI.Box(new Rect(0, 60, 200, 25), "Press E to swich off the light");
            }
            else
            {
                GUI.Box(new Rect(0, 60, 200, 25), "Press E to swich on the light!");
            }
        }
    }
    void OnTriggerEnter(Collider other)
    {
        InTrigger = true;
    }
    void OnTriggerExit(Collider other)
    {
        InTrigger = false;
    }