How do I make my sound only play once?

Here is my code:

function OnTriggerEnter(other: Collider){
if (!GetComponent.().isPlaying){
GetComponent.().Play();

}
}

public var soundToPlay : AudioClip;
var audioSource : AudioSource;

function Start() {
// Find AudioSource
audioSource = GetComponent.<AudioSource>();
}
        
function OnTriggerEnter() {
// Play soundToPlay once every time we enter the trigger
audioSource.PlayOneShot(soundToPlay);
}

Remove loop checkbox on audiosource or use this code GetComponent<AudioSource> ().loop = false