unity sometime execute instruction and sometime ignore same instruction ?!

Greetings

I have script which respawn player if he fall into water ( water object is plane ), this water object send damage to player health then player die and respawn to spawn point.
But sometime player does not respawn and he is keep falling then i need to restart the game.

these are the scripts

Player health:

    public int maxHealth = 100;

    public Transform spawnPoint;

    public int health = 100;

    private bool isDead;

    void Start()
    {
        health = maxHealth;
    }

    void Update()
    {
        if(isDead)
        {
            Respawn();
        }
        
    }

    public void TakeDamage(int amount)
    {
        health -= amount;

        if (health <= 0)
            Die();
    }

    void Die()
    {
        isDead = true;
    }

    void Respawn()
    {
        transform.position = spawnPoint.position;
        health = maxHealth;
        isDead = false;
    }

Water:

public int damage = 100;

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            other.GetComponent<PlayerHealth>().TakeDamage(damage);
        }
    }

what is the problem ?!

Planes are paper thin, so it seems the collision is not being detected on some cases. That’s a common issue.
You’ll likely want to make your water have a collision box with some height to allow a couple of frames of contact between player and water to ensure the collision is identified.

Also, as a fallback, you may have some checks on the player’s vertical position. If it’s less than whatever makes sense, the player fell out of the world and should be killed.

What kind of collider does your water “plane” object use? You should use a box collider with sufficient thickness. If the player moves at a high velocity it’s possible that the player misses a plane mesh collider and just falls “through”. At the right speed there will be no overlap between the colliders.

Have you actually checked with a Debug.Log if you enter the OnTriggerEnter method when your player falls through the trigger? If it doesn’t fire, there will be no overlap. Of course all this assumes that you player actually has a rigidbody attached.