Any way to add force to an instantiated object?

So I wanna shoot a bullet and add force to it when I instatiate it instead of making it fly upwards by itself. I have this script and it doesnt make the bullet fly upwards (a classic 2d space rocket game).

 private playerStats PlayerStats;
 private float FireRate;
 private float timeforShoot;
 public GameObject Lazer;
 public Transform Firepoint;
 void Start()
{
    PlayerStats = gameObject.GetComponent<playerStats>();

}

void Update()
{
    FireRate = PlayerStats.RATE;
    if(timeforShoot <= 0 && Input.GetKey(KeyCode.Space))
    {
        timeforShoot = FireRate;
        Shoot();
        
    }
    else
    {
        timeforShoot -= Time.deltaTime;
    }
}

void Shoot()
{
    Instantiate(Lazer, Firepoint.position, transform.rotation);
    Lazer.GetComponent<Rigidbody2D>().AddForce(transform.up * 1000);
}

}

“Lazer” is your prefab, that’s like a recipe from which a gameobject will be Instantiated. Currently in

 void Shoot()
 {
     Instantiate(Lazer, Firepoint.position, transform.rotation);
     Lazer.GetComponent<Rigidbody2D>().AddForce(transform.up * 1000);
 }

You are trying to add force to that prefab, not to newly created gameobject.

To fix it :

 void Shoot()
 {
     GameObject lazerBullet = Instantiate(Lazer, Firepoint.position, transform.rotation);
     lazerBullet.GetComponent<Rigidbody2D>().AddForce(transform.up * 1000);
 }