Multiplayer script access on Collision Enter

Hey I have a small single Player game.

The Player can pickup Boosters for which I have the following script attached to the Booster:

 override protected void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            //Set fire range of lasers to max
            playerControls.pickup = true;

        }
    }

So when the Player hits the powerup, the powerup sets the pickup bool in the playerControls to true.

This works as intedned right now. Now I wanted to add a multiplayer to my game. Each Player character has the playerControls script attached. If One Player picks up the powerup “pickup” on all Player scripts is being set to true.

How can I make it that only the pickup of the Player who collided with the powerup gets it ?

I already tried something like:

other.playerControls.pickup = true; but this does not work. Any clues ?

It seems that “playerControls.pickup” is static. You must remove the static trom it, because otherwise you have only one “playerControls.pickup”.
Then change your script like this:


     override protected void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.tag == "Player")
            {
                //Set fire range of lasers to max
                other.gameObject.GetComponent<playerControls>().pickup = true;
     
            }
        }

Please note thet I had not worked with multiplayer, so this script may not work.