Help! My projectile velocity is not working..

Hi there. I am making a 2D platformer game and I can’t solve why my projectile doesn’t move when instantiated. It is stuck at the player’s hand and immediately disappear.

In my player controller script:

     // projectile
     public Transform firePoint;
     public GameObject projectile      
         
     if(Input.GetKeyDown(KeyCode.X))
      {
           Instantiate(projectile, firePoint.position, firePoint.rotation);
      }

FirePoint is the position of the player’s hand and Projectile is my projectile gameobject.

And I attach this script to my projectile:

      public float speed;
         // Use this for initialization
         void Start () {
         
         }
         
         // Update is called once per frame
         void Update ()
         {
             GetComponent<Rigidbody2D>().velocity = new Vector2(speed, GetComponent<Rigidbody2D>
             ().velocity.y);
         }
     
         void  OnTriggerEnter2D(Collider2D other)
         {
             Destroy(gameObject);
         }

When I press X,
99895-aaaa.jpg
The projectile just appear and disappear immediately, but doesn’t transform to right.

However when I put one of the projectile by itself in the scene, it works perfectly fine. The projectile will move towards right.
99896-bbb.jpg
Why is that so??? Thanks for help!

Probably, your proyectile are Triggered by your player collider or other collider, find out.

void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag != "TAG OF YOUR PLAYER OR COLLIDER CAUSING THIS TRIGGER")
        {
            Destroy(gameObject);
        }
                
    }