Opening door with the same key?

Hey guys, i am struggeling a bit with opening doors with the same key.

For now im using a script that opens with E and closes with F. It also contains sound and text on trigger.
Any ideas what im missing?

//Script made by Strups Productions//
using UnityEngine;
using System.Collections;

public class doorOpenandClose : MonoBehaviour {

//Text variables
public bool T_ActivatedOpen = true;
public bool T_ActivatedClose = false;
public bool activateTrigger = false;

public GameObject textO;
public GameObject textC;

//Animator variables
Animator animator;
bool doorOpen;
//Sound variables
public GameObject doorOpenSound;
public GameObject doorCloseSound;

void Start () { //what happens in the beginning of the game.
	textC.SetActive (false);
	textO.SetActive (false);
	T_ActivatedOpen = true;
	T_ActivatedClose = false;

	animator = GetComponent<Animator> ();
	doorOpen = false;

	doorCloseSound.SetActive (false);
	doorOpenSound.SetActive (false);


}


void Update () { //The main function wich controlls how the system will work.

	if (T_ActivatedOpen == true)
		T_ActivatedClose = false;

	else if (T_ActivatedClose == true)
		T_ActivatedOpen = false;

	if (activateTrigger && Input.GetKeyDown(KeyCode.E)) //For some reaseon you can't have both E (open and close).
    {
			textO.SetActive (false);
			textC.SetActive (false);
			T_ActivatedOpen = false;
			T_ActivatedClose = true;
			textO.SetActive (false);
			textC.SetActive (true);
			doorOpen = true;

			doorOpenSound.SetActive (true);
			doorCloseSound.SetActive (false);

		if (doorOpen) 
		{
			doorOpen = true;
			doorController ("Open");
            
		}
			
		}
		else if(T_ActivatedClose && activateTrigger && Input.GetKeyDown(KeyCode.F)) 
		{
			T_ActivatedOpen = true;
			T_ActivatedClose = false;
			textO.SetActive (true);
			textC.SetActive (false);

			doorCloseSound.SetActive (true);
			doorOpenSound.SetActive (false);
           
        if (doorOpen) 
		{
			doorOpen = false;
			doorController ("Close");
		}
			
		} 
}

													
void OnTriggerEnter(Collider col) //If you enter the trigger this will happen.
{
	if(col.gameObject.tag == "Player")
	{

			activateTrigger = true;
		if((T_ActivatedOpen == true))
		textO.SetActive (true);

		if((T_ActivatedClose == true))
			textC.SetActive (true);
	}
	
}

void OnTriggerExit(Collider col) //If you exit the trigger this will happen.
{
	if(col.gameObject.tag == "Player")
	{
		textO.SetActive (false);
		textC.SetActive (false);
		activateTrigger = false;
	}

}

void doorController(string direction) //Animator function.
{
	animator.SetTrigger(direction);
}

}

I believe you have an error in your logic handling. You shouldn’t need to use different keys to open / close a door.

Very roughly this is what I would do:

bool isDoorOpen = false; 
public TextMesh keyPressPrompt; 
string s_actionKey = "Press E"; 
string s_openDoor = "Open Door"; 
string s_closeDoor = "Close Door"; 

void OpenCloseDoor ()
{
	// handle relevant open / close door animations
	if(isDoorOpen)
	{
		// close door animation
	}
	else
	{
		// open door animation
	}
	
	// toggle door open state
	isDoorOpen = !isDoorOpen; 	
}


void KeyPressPrompt (bool activate)
{
	if(!activate)
	{
		// handle deactivation animation etc
	}
	else
	{
		// handle activation animation etc
		
		// show Close Door Prompt if Door is Open, vice versa
		keyPressPrompt.text = (isDoorOpen ? s_closeDoor : s_openDoor) + "

" + s_actionKey;
}
}

void CheckForKeyInput ()
{
	if(Input.GetKeyDown(KeyCode.E))
		OpenCloseDoor(); 
}

void Start ()
{
	// init stuff
}

void Update ()
{
	CheckForKeyInput(); 
}

void OnTriggerEnter (Collider col)
{
	if(col.gameObject.tag == "Player")
		KeyPressPrompt(true); 
}

void OnTriggerExit (Collider col)
{
	if(col.gameObject.tag == "Player")
		KeyPressPrompt(false); 
}

Hope that helps get you on the right direction.