I think you wrote it to wrong place. This is not Chat GPT . Also if you post something you should look here first.
Using code tags properly - Unity Forum
Basically you just add listener to button and then call your function what change value.
Unity - Scripting API: Events.UnityEvent.AddListener (unity3d.com)