How to use trigger function to restart level

So,basically these are the codes to reset my scene

using System.Collections;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using UnityEngine;

public class Restart : MonoBehaviour {

public Scene loadedlevel;

void Start()
{
	 loadedlevel = SceneManager.GetActiveScene();
}

void OnTriggerEnter(Collider other)
{
	if (other.gameObject.tag == "Player") {
		SceneManager.LoadScene(loadedlevel.name);
	}
}

}
Well the general idea is to reset the scene whenever the ball falls of the plane. The code doesn’t seem to work when the ball falls down the surface(plane) and interacts with the trigger object.

First of all thanks for the reply…i tried the second one since the first one looks a bit complicated for me(new to unity xD). The code works thanks a lot.

@Funnuraba
I’ve prepared 2 solutions, one being a bit more complicated but will prevent error and the other very simple.

Hope this helps!!

complicated one:

`
using UnityEngine;
using UnityEngine.SceneManagement;

public class RestartOnHit : MonoBehaviour {

//to see what class the script should use but mainly to prevent errors
private enum collideOrTrigger
{
    trigger,

    collider
}

private collideOrTrigger cOrT;

private Collider col;

// Use this for initialization
void Start () {
    col = GetComponent<Collider>();

    if (col.isTrigger)
    {
        cOrT = collideOrTrigger.trigger;
    }
    else
    {
        cOrT = collideOrTrigger.collider;
    }
}

private void OnTriggerEnter(Collider other)
{
    if (cOrT == collideOrTrigger.trigger)
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

private void OnCollisionEnter(Collision collision)
{
    if (cOrT == collideOrTrigger.collider)
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

}

simple solution:

using UnityEngine;
using UnityEngine.SceneManagement;

public class SimplerestartOnCollide : MonoBehaviour {

private void OnTriggerEnter(Collider other)
{
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

private void OnCollisionEnter(Collision collision)
{
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

}

`