How do i get my fu... sound to play when i die? Im a complete beginner heeelp ;) #pragmastrictforlife Thanks Alot

#pragma strict
import UnityEngine.SceneManagement ; //ignore

var maxFallDistance = -10 ; //ignore
var Ernst1 : AudioClip ; //Tried both AudioCLip and AudioSource 

function Update ()
{
if (transform.position.y <= maxFallDistance) //ignore
{
GameMaster.currentScore = 0; //ignore
SceneManager.LoadScene(“banisch 1”) ; //ignore
Ernst1.Play(); //this little fucker. i get “play is not a member of Unityblabla.AudioClip” i’ve tried alot of different thigns but cant get it to work, i really have no idea
}

}

First, be sure to assign the ‘death sound’ to the Ernst1 AudioClip variable in the Inspector. Then you should attach an AudioSource component to the gameobject, declare an AudioSource typed variable (lets name it ‘audioManager’), and assign the AudioSource to the variable with this line:

audioManager = GetComponent<AudioSource>();

Whenever you want to play the sound, you can use:

audioManager.PlayOneShot(Ernst1);

oh, ill try that out thanks alot mate