Trigger Respawn Not working :/

Im trying to make it so that when the player enters the trigger he respawns back at the start of the level. i’ve used tutorials and i’ve tried debug.log on my script and i’ve found that it’s the part inside the if statement that is incorrectly working (transform.position = originalPos;) `using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Respawn2 : MonoBehaviour
{

Vector3 originalPos;
void Start()
{
    originalPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
    //alternatively, just: originalPos = gameObject.transform.position;

}
void OnTriggerEnter(Collider other)
{
    if (other.gameObject.tag == "Player")
    {
        transform.position = originalPos;
    
    }

}

}`

I don’t quite get why you search for a player tag when you try to move the player back? You should search for enemy, hazard, fire, lava etc. not for the player and then move the player back.

    public Vector3 originalPos;

    private void Start()
    {
        originalPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
    }

    private void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag == "Hazard")
        {
            transform.position = originalPos;
        }
    }