Trigger not working with a specific game object

Hello everyone,
I have a problem with a trigger.
Basicaly I want the the trigger to work only when the player pass on it.
But if an enemy collide with it or a bullet collide with it, it gets activated.
I tried to put a tag on the player but it doesn’t seems to work because the trigger doesn’t recognize the player or the bullet shooted from his gun.
Here is the script:

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

public class StartTrigger : MonoBehaviour
{
    public GameObject Player;

    public GameObject Spawns;

    public GameObject Trigger;


    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            Spawns.SetActive(true);
        }
        
    }

    void OnTriggerExit2D(Collider2D other)
    {
        Trigger.SetActive(false);
    }

The tag should definitely work. Is “Trigger” the gameObject with this script on it? Because currently anything that exits this trigger will cause that to be turned off. If you want to make sure that nothing besides the player will interact with this collider, the most foolproof way is to place the collider on a layer that doesn’t interact with any layers besides the one the player is on. That way nothing else will be able to trigger collisions with it.
For example, you create a layer called “Player” and another one called “Player Detection.” Then you place the player on the Player layer and this trigger on the Player Detection layer. In your physics settings, you go to the collision matrix and uncheck all the other layers from the list of those that can interact with player detection so only the box for the player layer is checked.