How do I make it so when player 1 touches the death barrier he is destroyed and a variable is changed? Same for a player 2.,How would i make it trigger each part when only that player?

I have 2 players 1 with wasd and the other with arrows. I am trying to make it so that if they fall of the platform the game object is destroyed and RedIsDed or YellowIsDed is set to true for whichever one died, this variable would then be taken to do a red/yellow victory. Currently nothing happens and the player falls through the barrier. The death barrier is tagged as “Barrier”.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class YellowKillBarrier : MonoBehaviour
{
public bool YellowIsDed;

void Start()
{
    gameObject.tag = "Yellow";
    YellowIsDed = false;
}

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Barrier")
    {
        YellowIsDed = true;
        Destroy(other.gameObject);
    }
}

}

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

public class RedKillBarrier : MonoBehaviour
{
public bool RedIsDed;

void Start()
{
    gameObject.tag = "Red";
    RedIsDed = false;
}

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Barrier")
    {
        RedIsDed = true;
        Destroy(other.gameObject);
    }
}

}

I currently have the script on an empty game object called Red and same for yellow, these objects have children which are the body, with box colliders, movement script and rigidbody. Children of the body are details like eyes. Does my code not work or have i put it somewhere wrong?,I have 2 players 1 with wasd and the other with arrows. I am trying to make it so that if they fall of the platform the game object is destroyed and RedIsDed or YellowIsDed is set to true for whichever one died, this variable would then be taken to do a red/yellow victory. Currently nothing happens. The death barrier is tagged as “Barrier”.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class YellowKillBarrier : MonoBehaviour
{
public bool YellowIsDed;

void Start()
{
    gameObject.tag = "Yellow";
    YellowIsDed = false;
}

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Barrier")
    {
        YellowIsDed = true;
        Destroy(other.gameObject);
    }
}

}

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

public class RedKillBarrier : MonoBehaviour
{
public bool RedIsDed;

void Start()
{
    gameObject.tag = "Red";
    RedIsDed = false;
}

private void OnTriggerEnter(Collider other)
{
    if (other.tag == "Barrier")
    {
        RedIsDed = true;
        Destroy(other.gameObject);
    }
}

}

Do i need to put script on the barrier? Or have i done the player scripts wrong? The player scripts are equipped to an empty game object and the empty game objects children are a square called body which has the movement script and rigidbody and box collider, inside the body (as children) are just details like eyes. Do I need to be tagging the body itself and not the empty game object and putting the script on the bodies, or does my script just not work?

add: debug.Log(“red”); to red and yellow script (changing for color respectively) and if it shows up in the console then it is colliding with the barrier but not destroying if not then make a variable: GameObject barrier; then drag the barrier to the gameobject within the script then instead of if (other.tag == “Barrier”) do if (other.tag == barrier (or whtever you name the barrier game object to)) if it still doesn’t work then change it back and make sure that the TAG of the barrier is Barrier instead of just the name of it (there should be a box in the top of the screen) if not then either then make sure that the barrier has 2 hitboxes: 1 for the collision (should be the size of the visual) only if you want the characters to be able to walk on it the other hitbox has is trigger checked and is taller by a few pixels then the collision (the larger the diference the sooner it will dissapear)