How to shoot the direction i am looking

Hi. this is the script i use for my gun to shoot. but it only shoots the same direction no matter what way i am looking. how can i fix that?

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

public class AssaultRifleCode : MonoBehaviour
{

    public float BulletSpeed;
    bool shoot = false;
    public GameObject bullet;
    public Transform bulletpos;

    void Start()
    {
       
    }

  
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {

            shoot = true;
        }
    }

    private void FixedUpdate()
    {
        if (shoot)
        {
            Shoot();

            shoot = false;
        }
    }

    void Shoot()
    {

        GameObject BulletSpawn = Instantiate(bullet, bulletpos.position, bullet.transform.rotation);
        BulletSpawn.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, BulletSpeed);

    }

}

You set the velocity of the bullet to (0,0,BulletSpeed) every time. This is independant of your rotation.
To make it depend on some other objects rotation, multiply its forward vector with your bullet speed. Using the same object as reference, you’d do transform.forward * BulletSpeed instead. The bullet will then fly in the forward direction of the instantiating object. You will probably also want to adjust the rotation in which you actually spawn the bullet to reflect the same direction tho.

Edit: By the way your variable naming conventions seem a bit arbitrary. Some, like bulletpos, you wrote all lower case, others like BulletSpeed you wrote in upper camel case. Variables should be standard camel case. At least if you are following common conventions, which you should for consistency. So it should be bulletSpeed, bulletPos and so on. Method, class and property names are written upper camel case like you are currently doing it.