When I shoot a projectile, it goes in the right direction, but when I shoot a projectile in the other direction, the previous one starts going in the direction of the last one

I know this happens because I assign a new value to all instances, but how do I make each instance have a separate value

PlayerScript

void Update()
{
    movementDir = new Vector3(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
    movement = movementDir.normalized * Playerspeed * Time.deltaTime;
    transform.position = transform.position + movement;
   
    if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        GameObject BulletInstance = Instantiate(bullet, transform.position, Quaternion.identity);
        direction = Vector3.down;
    }
    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        GameObject BulletInstance = Instantiate(bullet, transform.position, Quaternion.identity);
        direction = Vector3.up;
    }
}

Projectile

public Player myPlayer;
void Start()
{
    myPlayer= GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
}

void Update()
{
    transform.Translate(myPlayer.direction * 4 * Time.deltaTime, Space.World);
}

Well, it’s because the Projectile’s update relies on player’s current direction that’s changed in player when shooting. Every projectile needs to have its own direction, copied to it after instantiation during shooting.

A bit off the original topic, but in an ideal design, the projectile, unless there’s a special reason for it, should not depend on the existence of a player or weapon that fired it. Imagine now that an identical projectile would be fired by a turret - it can’t be, because of the unnecessary relation of the projectile to a player. Keep your dependencies to a minimum, have an easier life.