[SOLVED] Accessing string from another script

I have a string in another script which gets updated every time the player switches weapons. Its purpose is to let my PlayerShoot script know which weapon we have equipped and then play the according sound. However, my code does not throw any errors although the sounds are not playing. I have tested the sound by placing the CmdPlayAwpShootSound(); and the CmdPlayTecShootSound();lines in the Start() function and the sounds played.

String we are trying to access:

public string currentHolder;

void Start ()
{
    currentHolder = "awpweaponHolder";
    EquipAwpWeapon(primaryWeapon);
}

void Update()
{
    if(Input.GetAxis("WeaponSwitch") >0f)
    {
        currentHolder = "tecweaponHolder";
        EquipTecWeapon(secondaryWeapon);
        Debug.Log("switched weapon");
    }
    else if (Input.GetAxis("WeaponSwitch")<0f)
    {
        currentHolder = "awpweaponHolder";
        EquipAwpWeapon(primaryWeapon);
        Debug.Log("switched weapon back");
    }
}

PlayerShoot script:

void Update ()
{
    currentWeapon = weaponManager.GetCurrentWeapon();

    if (PauseMenu.IsOn)
        return;

    if (currentWeapon.fireRate <= 0f)
    {
        if (Input.GetButtonDown("Fire1") && weaponManager.currentHolder == "awpweaponHolder")
        {
            Shoot();
            CmdPlayAwpShootSound();
            Debug.Log("play awp sound");

        }else if (Input.GetButtonDown("Fire1") && weaponManager.currentHolder == "tecweaponHolder")
        {
            Shoot();
            CmdPlayTecShootSound();
            Debug.Log("play tec sound");
        }

    } else

Are your debug’s printing out?
Did you print what weaponManager.currentHolder is? I would put in a print statement right at the start of your if(currentWeapon.fireRate <= 0f) if statement to make sure you’re getting the right value.

Also, is weaponManager just a single script used to manage all your weapons?

Thanks for your reply, I realised that my code was not formatted properly and my if statements weren’t actually getting executed :')