How to create a working microphone?

I’ve been trying out ferret224’s udon code for making an area you enter increase your voice range but I dont know what I’m doing wrong with it. I feel like starting fresh on the matter and mayhaps theres a simpler way of just making the microphone have a use input that does the same. Tried it. but not sure how to make it usable. (I’m very new at Udon and coding in general any help would be appreciated)

This is some code that should provide a microphone effect. add it to an object.

When a player picks up an object with this code added, and then clicks their trigger once it will increase their volume and range to a configurable value.

when the player drops the object it sets their volume back to default.

Note: I haven’t tested this, but this should act as a decent starting point.

public class testmicrophone : UdonSharpBehaviour {

    public float Gain; //the desired increased gain vaule
    public float NearRange; //the desired increased near range value

    [UdonSynced] private bool IsInUse;


    public override void Interact() { //when the player clicks their trigger after picking up the microphone this runs
        if (Networking.IsOwner(Networking.LocalPlayer, gameObject)) { Networking.SetOwner(Networking.LocalPlayer, gameObject); } //makes sure the person holding the object is its owner ()might be unnecessary
        IsInUse = true;
        RequestSerialization();
    }
    private void Update() {
        if (!GetComponent<VRC_Pickup>().IsHeld && IsInUse) { //this checks if they've dropped it and if it's still in use sets it to not use 
            IsInUse = false;
            RequestSerialization();
        }
    }


    public override void OnDeserialization() {
        if (IsInUse) {
            IncreaeUserVolume();
        }
        else{
            DecreaseUserVolume();
        }
    }

    public void IncreaeUserVolume() {
        VRCPlayerApi Player = Networking.GetOwner(gameObject);

        Player.SetVoiceGain(Gain);
        Player.SetVoiceDistanceNear(NearRange);
    }
    public void DecreaseUserVolume() {
        VRCPlayerApi Player = Networking.GetOwner(gameObject);

        Player.SetVoiceGain(15);
        Player.SetVoiceDistanceNear(0);
    }

    public override void OnPlayerJoined(VRCPlayerApi player) {
        RequestSerialization();
    }
}

Hope this is helpful.