How to add the option to change field of view through using a slider in a game option menu?

I have a project of creating a multiplayer FPS and I am trying to make the options menu for it. I don’t understand how I can use a slider in game to change the the FOV of the camera from the options menu.

public Slider fovSlider;

public void SubmitButton{
   Camera.main.fieldOfView = fovSlider.value;

You can make slider range of values, add a public method to the button that will accept player fov changes and it should apply like I wrote above.