I'm trying to figure out how to stop all camera movement on the y-axis (pitch) and make the mouse cursor reappear by pressing a key.

I’m making a first person game with dialogue choices. I have the dialogue worked out however what I’m having trouble with is writing code to make it so that when I press the Return key, the main camera cannot move on at least the y-axis and the mouse cursor reappears (like it does when pressing esc). Then, when the dialogue ends, the camera returns to normal and the cursor is hidden.

I have looked at the following post which is the closest to what I’m looking for however since I’m working with VIDE, I personally found it too difficult to compare the code and work from there since I’m new to coding.

Camera Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseLook : MonoBehaviour
{
    public float speedH = 2f;
    public float speedV = 2f;

    private float yaw = 0f;
    private float pitch = 0f;

    // Start is called before the first frame update
    void Start()
    {
      Cursor.lockState = CursorLockMode.Locked;
    }

        // Update is called once per frame
        void Update()
        {
            yaw += speedH * Input.GetAxis("Mouse X");
            pitch -= speedV * Input.GetAxis("Mouse Y");

            transform.eulerAngles = new Vector3(pitch, yaw, 0f);

            pitch = Mathf.Clamp(pitch, -90f, 90f);
        }
}

Dialogue script:
using UnityEngine;
using System.Collections;
using VIDE_Data; //Access VD class to retrieve node data
using UnityEngine.UI;

public class UIManager4 : MonoBehaviour
{
    public GameObject container_NPC;
    public GameObject container_PLAYER;
    public Text text_NPC;
    public Text[] text_Choices;

    void Start()
    {
        container_NPC.SetActive(false);
        container_PLAYER.SetActive(false);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (!VD.isActive)
            {
                Begin();
            }
            else
            {
                VD.Next();
            }
        }
    }

    void Begin()
    {
        VD.OnNodeChange += UpdateUI;
        VD.OnEnd += End;
        VD.BeginDialogue(GetComponent<VIDE_Assign>());
    }

    void UpdateUI(VD.NodeData data)
    {
        container_NPC.SetActive(false);
        container_PLAYER.SetActive(false);

        if (data.isPlayer)
        {
            container_PLAYER.SetActive(true);

            for (int i = 0; i < text_Choices.Length; i++)
            {
                if (i < data.comments.Length)
                {
                    text_Choices*.transform.parent.gameObject.SetActive(true);*

text_Choices_.text = data.comments*;
}
else
{_
text_Choices.transform.parent.gameObject.SetActive(false);
_}
}
text_Choices[0].transform.parent.GetComponent().Select();
}
else
{
container_NPC.SetActive(true);
text_NPC.text = data.comments[data.commentIndex];
}
}*_

void End(VD.NodeData data)
{
container_NPC.SetActive(false);
container_PLAYER.SetActive(false);
VD.OnNodeChange -= UpdateUI;
VD.OnEnd -= End;
VD.EndDialogue();
}

void OnDisable()
{
if (container_NPC != null)
End(null);
}

public void SetPlayerChoice(int choice)
{
VD.nodeData.commentIndex = choice;
if (Input.GetMouseButtonUp(0))
VD.Next();
}
}
Any help would be greatly appreciated :).

Maybe, for camera rotation, try disabling the MouseLook component. Releasing the cursor usually works with Unity - Scripting API: Cursor

public MouseLook mouseLook;

...

// execute this when pressing Enter
private void EnableMouse()
{
    mouseLook.enabled = false;
    Cursor.lockState = CursorLockMode.None;
    Cursor.visible = true;
}

And resp. the opposite to give control to the FPS again.

Background: If you disable any script component, its Start and Update method (and some other Unity specific methods) won’t be called.