Turn Based - Multiple players fire even if not active

I am running into an issue where i have multiple spawns, which take turn on attacking, so they are controlled by the same player and have the same controls

in my player movement script, i have it check to see if the player is active, then if active they can move, then shoot, once they shoot it calls the function in another script to switch which player is now active.

However everytime i hit space, all players shoot, even the ones that show inactive, its like the code ignores the if statement still runs some of the code but not all of it.

Code as follows:

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

public class PlayerMovement : MonoBehaviour
{
    // call script with player movement controls
    public CharacterController2D controller; 
    // set speed player can move at
    public float runSpeed = 40f; 
    float horizontalMove = 0f;
    float weaponAngle;
    float weaponPower;
    bool active ;


    // Update is called once per frame
    void Update()
    {
        active = this.gameObject.GetComponent<Unit>().isActive;
        if(active == true)
        {
            horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
        }
       
    }

    void FixedUpdate()
    {
        active = this.gameObject.GetComponent<Unit>().isActive;
        Debug.Log(active);
        if(active == true)
        {
            // Move our Character
            controller.Move(horizontalMove * Time.fixedDeltaTime, false, false);
            weaponAngle = this.gameObject.GetComponent<Unit>().weaponAngle;
            weaponPower = this.gameObject.GetComponent<Unit>().weaponPower;

            if(Input.GetKeyUp(KeyCode.Space))
            {
                Vector2 velocity = new Vector2( 
                weaponPower * Mathf.Cos(weaponAngle * Mathf.Deg2Rad),
                weaponPower * Mathf.Sin(weaponAngle * Mathf.Deg2Rad)
                );
        
                this.gameObject.GetComponent<Unit>().FireBullet( transform.position, velocity );
                GameObject go = GameObject.Find("BattleSystem");
                BattleSystem ca = (BattleSystem) go.GetComponent(typeof(BattleSystem));
                ca.changeActive();
            }
        }
    }
}

Got this fixed thanks to someone on the Unity Discord (Sundiray_2586)

fixed code is: https://pastebin.com/aNcQJVL9

we basically moved the getkeyup to Update and it sets a bool to true, then in the fixed update if true it would fire and then set the bool to false.

now only one player fires at a time before switching to the next player