Why isn't my object being destroyed?

So I have a script attached to a GameObject that shoots bullets every second and i want to destroy those bullets once they’re off-screen.

I have this script:

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

public class enemyScript : MonoBehaviour {

    public Transform bullet1;
    public Transform bullet2;

	// Use this for initialization
	void Start () {
        InvokeRepeating("ShootBullets", 1, 2);        
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    void ShootBullets()
    {
        Transform flyingBullet1 = Instantiate(bullet1, bullet1.position, Quaternion.identity);
        Transform flyingBullet2 = Instantiate(bullet2, bullet2.position, Quaternion.identity);

        flyingBullet1.GetComponent<Rigidbody2D>().AddForce(Vector3.down * 200);
        flyingBullet2.GetComponent<Rigidbody2D>().AddForce(Vector3.down * 200);
       
        if(flyingBullet1.position.y < -5)
        {
            Destroy(flyingBullet1.gameObject);
        }
    }
}

But the bullets are not being destroyed. I tried it with DestroyImmediate as well but same result, bullets are not destroyed. I don’t have that much experience with Unity yet, so can someone tell me what I’m doing wrong? Thank you in advance!

Maybe what you can do is add a script to the bullet prefab (rather than destroying them on the spawner script) to destroy the bullets when they reach a certain point. It may also me a good idea to use camera bounds rather than hard coded positions. This way, if the camera ever needs to move or the aspect changes, you’re covered.

public Camera cam;
public float cam_height;
public float cam_width;

void method(){
    cam = Camera.main;
    // Added "+1" so that the bullets no not destroy on the border and will destroy off screen
    cam_height = cam.orthographicSize + 1; 
    cam_width = cam.orthographicSize * cam.aspect + 1;

    if(gameObject.transform.position.x >= cam_width){
        destroy(gameObject);
    }
}

Hope this helps!