Get audio to just play once

Hi, my audio repeats even though I don’t have loop checked on the Audio Source.

How can I get my audio to just play once:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class DoorController : MonoBehaviour {

	public Animator anim;
	public AudioClip VaultOpening;

    public bool isOpen;
    public List<Pickup.ItemType> requiredItems = new List<Pickup.ItemType>();

    void Update()
            //if door is open code
			anim.enabled = true;
			GetComponent<AudioSource> ().clip = VaultOpening;
			if (!GetComponent<AudioSource>().isPlaying)
            //if door is closed code
			anim.enabled = false;
        if (requiredItems.Count == 0) isOpen = true;


well your audiosource will play imedeiatly after clip is finished again. because you check if the audiosource isnt playing, which is always true when the clip is finished. maybe try it with a bool if it’s a one time thing you could set the bool in the start function to true. and the when the audioclip is finished to false. something like this:

bool sound;

void Start()
{sound =true;}
void Update()
 if (sound)
if (!audiosource.isPlaying){
sound = false;