audio endlessly repeats and dupes

Hi im trying to make it so when the funtion open is called it plays an audio clip once but it is called in the update funtion so it will do it almost endlessly i tried to counteract that by using an if statement that would check if an audio clip is already playing dont do it but it still seams to loop and dupe any ideas?

using UnityEngine;
using System.Collections;

public class OpenandClose : MonoBehaviour {
	public Vector3 open;
	public Vector3 close;
	public float smooth;

	public int movez;
	public AudioClip opena;
	public AudioClip closea;

	void Start()
	{
		close = transform.localPosition;
		open = transform.localPosition;
		close.z += movez;
	}
	public void Open()
	{
		transform.localPosition = Vector3.Lerp (transform.localPosition, open, Time.deltaTime * smooth);
		if(audio.isPlaying == false)
		audio.PlayOneShot(opena);
		
	}

	public void Close()
	{
		transform.localPosition = Vector3.Lerp (transform.localPosition, close, Time.deltaTime * smooth);
		if(audio.isPlaying == false)
		audio.PlayOneShot(closea);
	}
}


using UnityEngine;
using System.Collections;

public class openandcloseplayer : MonoBehaviour {

	bool openclose;
	OpenandClose script;
	void Update() 
	{
		if (Input.GetMouseButtonDown(2))
		{
			RaycastHit hit;
			Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
			if (Physics.Raycast(ray, out hit))
			{
				if (hit.collider.gameObject.tag == "Openable") 
				{
					script = hit.collider.gameObject.GetComponent<OpenandClose>();
					openclose = !openclose;
				}
			}
		}
		if (openclose == true)
		{
			script.Open();
		}
		else
		{
			script.Close();
		}
		
	}

}

It’s because you are firing OneShots and have an if else that always wants to do something even if the door isnt being interacted with.

try

 void Update() 
     {
         if (Input.GetMouseButtonDown(2))
         {
             RaycastHit hit;
             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
             if (Physics.Raycast(ray, out hit))
             {
                 if (hit.collider.gameObject.tag == "Openable") 
                 {
                     script = hit.collider.gameObject.GetComponent<OpenandClose>();
                     openclose = !openclose;
                     if (openclose == true)
                      {
                      script.Open();
                      }
                      else
                      {
                      script.Close();
                      }
                 }
             }
         }
     }

here the openclose audio script is only used when the door is actually the target of the click, otherwise in the loop, as has been mentioned, the audioclip is always going to be playing as openclose always has a value.