Can I make use of an audioclip in Script#2 if I call a function using it in Script#1?

Whenever I switch weapons it plays the Weapon script’s last registered audioclip assigned to the audiosource (i.e. a gunshot, or a hammer strike) and does not replace it with the clip from the WeaponManager outWeapon.TakeOut() call.

For some context:

I have a weaponManager script that handles collected weapons and weapon switching. My individual weapons then have either a ‘Weapon’ script which includes firearm stats etc, or a specific tool script like ‘Hammer’ or ‘Fuel Can’. They work similarly.

Whenever I switch weapons in the weaponManager script I call a function ‘weaponOut.TakeOut()’ from the weapon / tool script which looks like this:

(Script #1) Call:

 if (i == index && WeaponsCollected*)*

{

Weapons*.gameObject.SetActive(true); // Gets decided weapon out*
Weapon outWeapon = Weapons*.gameObject.GetComponent();*
if (Weapons*.gameObject.name == “Hammer”) // or other tools*
{
outWeapon.TakeOut();
}
else
{
StartCoroutine(outWeapon.TakeOut());
}
activeWeapon = i;
}
else
{
Weapons*.gameObject.SetActive(false);*
}
(Script #2) TakeOut:
public void TakeOut() // Drawing the hammer tool from equipment
{
audSource.clip = drawHammer;
audSource.PlayOneShot(audSource.clip);
}

Try making script 2 look like this. If the assertions fail, you need to look at your gameObjects in the inspector.

using UnityEngine;
 using System.Collections;
 using UnityEngine.Assertions;

public class myScript2: MonoBehaviour
{
    public AudioClip drawHammer;
    AudioSource audSource;

    void Start()
    {
        audSource= GetComponent<AudioSource>();
        Assert.IsNotNull (audSource);
    }

    public void TakeOut() 
    {
        Assert.IsNotNull (drawHammer);
        audSource.PlayOneShot(drawHammer, 1.0f);
    }
}