Problem with sounds, please help!

I have this script (it’s only part of one), and it won’t work. I want to stop the sound but it says some errors.

Script:

if(sound){
if(Input.GetMouseButtonDown(0)  enter  open){
AudioSource.PlayClipAtPoint(openSound, transform.position);
audio.clip = closeSound;
audio.Stop(closeSound); //line 42
}

if(Input.GetMouseButtonDown(0)  enter  !open){
AudioSource.PlayClipAtPoint(closeSound, transform.position);
audio.clip = openSound;
audio.Stop(openSound); //line 48
}

if(Input.GetMouseButtonDown(0)  locked  enter2){
AudioSource.PlayClipAtPoint(lockedSound, transform.position);
}
}

Errors:

Please help! Thanks in advance! :slight_smile:

Just type

audio.Stop();

instead of audio.Stop(“nameOfSound”)

Audio.stop () takes no arguments… it just stops that audio source.

AudioSource.Stop() doesn’t take any arguments.

Thanks a lot guys… That was pretty dumb mistake though.