My KillPlayer Code wont work! Please help!

I typed the code: using UnityEngine;
using System.Collections;

public class KillPlayer : MonoBehaviour {

public LevelManager levelManager;

//Using this for initalization
void Start () {
	levelManager = FindObjectOfType<LevelManager>();
}

//Update is called once per frame
void Update () {

}

void OnTriggerEnter2dCollider2D other)
{
	if(other.name == "Player")
	}
		levelManager.RespawnPlayer();
	{
	

}

}

And I got 4 errors. 1 of them was “error CS1519: Unexpected symbol ‘other’ in class, struct, or interface member declaration”
Another one of them was " error CS1519: Unexpected symbol ‘)’ in class, struct, or interface member declaration"
Another one was “error CS1519: Unexpected symbol ‘==’ in class, struct, or interface member declaration”
Another one was “error CS8025: Parsing error”

Please Help! Gamesplus James or any other user I really need help!

@CBJEntertainment

Your OnTriggerEnter2D() method is a mess. Your missing a parenthesis and so the compiler is confused as to what you’re trying to achieve. Try re-typing it like this:

using UnityEngine;
using System.Collections;

public class KillPlayer : MonoBehaviour
{

      public LevelManager levelManager;

      void Start ()
      {
            levelManager = FindObjectOfType<LevelManager>();
      }

      void Update ()
      {
      }

      void OnTriggerEnter2D (Collider2D other)
      {
            if(other.name == "Player")
            {
                   levelManager.RespawnPlayer();
            }
      }
}

Hope it helps!

Thank you so much! This works now :smiley: