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;
}
}
}`