Help with my gun system,How to have player pick up gun

so I have 2 codes one is a PickUpGun script which allows player to go to the gun Game Object and pick it up, which activates it in the players inventory. I have also got another script which allows you to switch items in your hand from your inventory. So what I am trying to accomplish is to say at the start of the game you have to find the gun and pick it up and it will be active in your inventory. But what happens is that when I start the game if I press 2 the gun comes into my hands, I can still pick up the gun from the floor but its pointless.

Here is my code:

PickUpGun Script-

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

public class PickUpGun : MonoBehaviour
{
public GameObject GunOB;
public GameObject invOB;
public GameObject pickUpText;
public AudioSource PickUpSound;

public bool inReach;

void Start()
{
    inReach = false;
    pickUpText.SetActive(false);
    invOB.SetActive(false);
    
}

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.tag == "Reach")
    {
        inReach = true;
        pickUpText.SetActive(true);

    }
}

void OnTriggerExit(Collider other)
{
    if (other.gameObject.tag == "Reach")
    {
        inReach = false;
        pickUpText.SetActive(false);

    }
}

void Update()
{
    if (inReach && Input.GetButtonDown("Interact"))
    {
        GunOB.SetActive(false);
        PickUpSound.Play();
        invOB.SetActive(true);
        pickUpText.SetActive(false);
    }

   

}

}

and here is my WeaponSwitch Script-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponsSwitch : MonoBehaviour
{
public GameObject object01;
public GameObject object02;
public GameObject object03;
public GameObject GunOB;

void Start()
{
    object01.SetActive(false);
    object02.SetActive(false);
    object03.SetActive(false);

}

void Update()
{
    if(Input.GetButtonDown("1"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(false);
    }

    if (Input.GetButtonDown("2"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(false);
       
    }

    if (Input.GetButtonDown("3"))
    {
        object01.SetActive(false);
        object02.SetActive(true);
        object03.SetActive(false);
    }

    if (Input.GetButtonDown("4"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(true);
    }
    
    
}

}

I am not so familiar with coding with Visual Studio, if you could help me I will be very thankful. ,So I have 2 codes one is a PickUpGun script which allows player to go to the gun Game Object and pick it up, which activates it in the players inventory. I have also got another scripts which allows you to switch items in your hand from your inventory. So what I am trying to accomplish is to say at the start of the game you have to find the gun and pick it up and it will be active in your inventory. But what happens is that when I start the game if I press 2 the gun comes into my hands, I can still pick up the gun from the floor but its pointless.

Here is my code:
PickUpGun Script-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PickUpGun : MonoBehaviour
{
public GameObject GunOB;
public GameObject invOB;
public GameObject pickUpText;
public AudioSource PickUpSound;

public bool inReach;

void Start()
{
    inReach = false;
    pickUpText.SetActive(false);
    invOB.SetActive(false);
    
}

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.tag == "Reach")
    {
        inReach = true;
        pickUpText.SetActive(true);

    }
}

void OnTriggerExit(Collider other)
{
    if (other.gameObject.tag == "Reach")
    {
        inReach = false;
        pickUpText.SetActive(false);

    }
}

void Update()
{
    if (inReach && Input.GetButtonDown("Interact"))
    {
        GunOB.SetActive(false);
        PickUpSound.Play();
        invOB.SetActive(true);
        pickUpText.SetActive(false);
    }

   

}

}

and here is my WeaponSwitch Script-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponsSwitch : MonoBehaviour
{
public GameObject object01;
public GameObject object02;
public GameObject object03;
public GameObject GunOB;

void Start()
{
    object01.SetActive(false);
    object02.SetActive(false);
    object03.SetActive(false);

}

void Update()
{
    if(Input.GetButtonDown("1"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(false);
    }

    if (Input.GetButtonDown("2"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(false);
       
    }

    if (Input.GetButtonDown("3"))
    {
        object01.SetActive(false);
        object02.SetActive(true);
        object03.SetActive(false);
    }

    if (Input.GetButtonDown("4"))
    {
        object01.SetActive(false);
        object02.SetActive(false);
        object03.SetActive(true);
    }
    
    
}

}

I am not so familiar with coding with Visual Studio, if you could help me I will be very thankful.

You wanna check if the gun has been picked up already

Make a bool in the PickUpScript called HasGunBeenPickedup or what ever you wanna call it

then in the GunSwitch class check if the player has the Gun


Example:

public class WeaponSwitch : MonoBehaviour
{

    //Refrence to the PickUP Class So we can check if player has the gun
    public PickUp pickupClass;


    void Update()
    {

        //Check if the player hit "2" AND (&&) if the player has picked of the gun
        if (Input.GetButtonDown("2") && pickupClass.HasPickedUpGun) //if player doesnt have the gun nothing will happen
        {
            

            object01.SetActive(false);
            object02.SetActive(false);
            object03.SetActive(false);


        }
    }
}
public class PickUp : MonoBehaviour
{

    //Player has gun bool
    public bool HasPickedUpGun = false;

    void Update()
    {
        if (inReach && Input.GetButtonDown("Interact"))
        {
            GunOB.SetActive(false);
            PickUpSound.Play();
            invOB.SetActive(true);
            pickUpText.SetActive(false);

            //Set HasGun to true
            HasPickedUpGun = true;

        }


    }
}