Ok guys, I’m going to cut to the chase. I’ve been skewering these forums for days now trying to get the right skript for a perfect audio jumpscare (WHERE THE TRIGGER IS DELETED AFTERWARD, SO THAT IT CAN ONLY HAPPEN ONCE) and it seems like no matter what I try to fix or copy and paste, it will not work!
I want to make it to where the player walks through a BoxCollider named “TreeSnapTrigger” and an audio clip that I have attached to the collider plays. And I only want it to be able to play ONE TIME. This is my script. Please tell me what i’m doing wrong.
var ThisTrigger : GameObject;
function OnTriggerEnter(other: object) {
if (otherObj.tag == "Player")
{
audio.PlayOneShot();
}
else {
audio.Stop();
}
}
function OnTriggerExit(other: object) {
Destroy (ThisTrigger);
}