Clamping Head Rotation

I am working on a first person controller script and I need to clamp the rotation down so that it can only rotate up and down between -90 and 90 degrees. I googled it, found some solutions but they are clearly outdated because even when I copy verbatim, it underlines in red. Any up to date help would be greatly appreciated. Below is the code I am using:

private void FixedUpdate()
{
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");
    float rotateXaxis = Input.GetAxis("Mouse Y");
    float rotateYaxis = Input.GetAxis("Mouse X");
 
   

    

    Vector3 movement = new Vector3(moveHorizontal, 0, moveVertical);
    Vector3 lookAbout = new Vector3(rotateXaxis, rotateYaxis, 0);
    transform.Translate(movement * walkSpeed * Time.deltaTime, Space.Self);
    transform.eulerAngles.y = Mathf.Clamp(transform.eulerAngles.y, -90, 90);

Just attache this to the camera. I would recommend using a mouseSensitivity of 200.

using UnityEngine;
public class Test : MonoBehaviour
{
    public float moveSensitivity;

    float x;
    float y;

    private void Update()
    {
        x -= Input.GetAxisRaw("Mouse Y") * moveSensitivity * Time.deltaTime;
        y += Input.GetAxisRaw("Mouse X") * moveSensitivity * Time.deltaTime;
        x = Mathf.Clamp(x, -90, 90);
        transform.rotation = Quaternion.Euler(x, y, 0);
    }
}