fps shooting in the direction of character main cam

hi im having trouble shooting in my fps game the script i am using is below. the script allows me to fire horizontally but it doesnt take into account the angle the cam is so if i look up or down the bullet still fires along the horizontal plane.
any suggestions?

//player 1 shoot


    function Update() 
    {
       if(Input.GetButtonDown("Fire1"))
       {
          var bullit =Instantiate(bullitPrefab,
                   GameObject.Find("Main Camera").transform.position,
                   transform.rotation);
           bullit.rigidbody.AddForce(transform.forward * 4000);
       }
    }
    

The easiest way is to create an empty game object (the spawn point) and child it to the camera. Adjust the position and rotation of this empty object: the Z axis (blue) must point in the same direction as the camera, and its position must be 1 to 2 units ahead of the player (to not collide with it). Add the shooting script below to this game object:

var bullitPrefab: Transform; 

function Update() 
{
  if(Input.GetButtonDown("Fire1"))
  {
     var bullit =Instantiate(bullitPrefab, transform.position, transform.rotation);
     bullit.rigidbody.AddForce(transform.forward * 4000);
  }
}

Since the spawn point object is childed to the camera, it will point wherever the camera points.