Bullet follows player mouvement when It instintiates.

I want it to just translate to the direction i give it not follow my mouvement. Thanks for your help!
bullet script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : PhysicsObject
{

public float Speed;
public float LifeTime;
 


public GameObject destroyEffect;
public Rigidbody2D rg2D;


void Start()
{
    Invoke("DestroyEffect", LifeTime);
}

private void Update()
{

    
    if ( GameObject.Find("ak").GetComponent<SpriteRenderer>().flipX )
        {

        transform.Translate(-transform.right * Speed * Time.deltaTime);
        GetComponent<SpriteRenderer>().flipX = true;
          
        
       

         }
    else 
    {

        transform.Translate(transform.right * Speed * Time.deltaTime );
        GetComponent<SpriteRenderer>().flipX = false;
        

    }
    

    

            
        
    

}

void DestroyProjectile()
{

    Instantiate(destroyEffect, transform.position, Quaternion.identity);
    Destroy(gameObject);

}

}

Weapon script

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

public class weapon : MonoBehaviour
{
public GameObject Projectile;
public Transform ShootPoint;

private float TimeBtwShots;
public float StartTimeBtwShots;

public float MaxSpeed = 7f;
public float jumpTakeOffSpeed = 7;
private SpriteRenderer SpriteRenderer;
private float MouvementSpeed;

// Update is called once per frame
private void Update()
{

    Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
   

    if (TimeBtwShots <= 0) ;
    {
        if (Input.GetButtonDown("Fire1"))
        {

            Instantiate(Projectile, ShootPoint.position, transform.rotation);

            TimeBtwShots = StartTimeBtwShots;

            

            

        }
        else
        {

            TimeBtwShots -= Time.deltaTime;

        }
    }

}

void FixedUpdate()
{

    if (GetComponent<Rigidbody2D>().velocity.x < 0)
    {

        GetComponent<SpriteRenderer>().flipX = true;
    }

    if (GetComponent<Rigidbody2D>().velocity.x > 0)
    {

        GetComponent<SpriteRenderer>().flipX = false;
    }

}

}

If I understand correctly, you are basing the projectile’s movement based on the facing of your ak in the Update method (which means in every frame). This is not a good solution because obviously your facing can change. What you can easily do is have the weapon script communicate to the bullet script the direction with which to move.

In bullet script:

int direction;

public void SetDirection(int _direction)
{
	direction = _direction;
}

 void Start()
 {
     Invoke("DestroyEffect", LifeTime);
	 if (direction < 0)
	 {
		GetComponent<SpriteRenderer>().flipX = true;
	 } 
	 else 
	 {
		GetComponent<SpriteRenderer>().flipX = false;
	 }
 }

private void Update()
{
	transform.Translate(transform.right * direction * Speed * Time.deltaTime);
}

In weapon script:

int direction;
SpriteRenderer rend;	//cache this, don't look for it every fixed update
Rigidbody2D rb2d;	//same

void Start()
{
	rend = GetComponent<SpriteRenderer>();
	rb2d= GetComponent<Rigidbody2D >();
}

 void FixedUpdate()
 {
     if (rb2d.velocity.x < 0)
     {
         rend.flipX = true;
		 direction = -1;
     }
     if (rb2d.velocity.x > 0)
     {
         rend.flipX = false;
		 direction = 1;
     }
 }
 
  private void Update()
 {
     Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
    
     if (TimeBtwShots <= 0) ;
     {
         if (Input.GetButtonDown("Fire1"))
         {
			
            GameObject bullet = Instantiate(Projectile, ShootPoint.position, transform.rotation);
			Bullet bulletScript = bullet.transform.GetComponent<Bullet>();	//get Bullet script
			bulletScript.SetDirection(direction);	//set direction same as the direction of weapon
            TimeBtwShots = StartTimeBtwShots;
         }
         else
         {
             TimeBtwShots -= Time.deltaTime;
         }
     }
 }