Question by
Jlmccart01 · Dec 31, 2015 at 09:41 PM ·
scripting problemscript error
Death Script
So I have searched around and found a piece of code that could help, but it was not what I needed so I modified it to do what I thought it would do, but it just does not work. The code is meant to make it so that when the player in this case the FPSController falls into an empty (yes it has a box collider set as trigger) it would send them to the death scene I created. Unless there is a more efficient way to do this I do not understand why it does not work.
using UnityEngine;
using System.Collections;
public class DeathScript : MonoBehaviour {
void OnTriggerEnter(Collider col) {
if(col.gameObject.name == "Player") {
{
Destroy (col.gameObject);
Application.LoadLevel (3);
}
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612054531im_/https://answers.unity.com/themes/thub/images/avi.jpg)