Having an issue with instantiating objects on button clicks

Theres a button in my scene and I want to instantiate an object when I press it but it returns the error:

Type IPointerClickHandler expected Button received. i:0. The variable bullet of helicopter has not been assigned.
You probably need to assign the missile variable of the helicopter script in the inspector

public Rigidbody bullet;

public void fire()
    {
        Rigidbody clone;
        
        clone = Instantiate(bullet, transform.position, transform.rotation) as Rigidbody;
        clone.velocity = transform.TransformDirection(Vector3.forward * 10);
    }

I have the bullet prefab on my object in the inspector and my button uses the function above when clicked so I don’t know what the problem is, if anyone could help, I’d appreciate it

change the code to:

public GameObject bullet;

public void fire()
{
 GameObject clone;
 
 clone = Instantiate(bullet, transform.position, transform.rotation) as GameObject;
 clone.rigidbody.velocity = transform.TransformDirection(Vector3.forward * 10);
}

you may need to delete and recreate the button in the scene for some reason to get it to work.