First person view keeps glitching out

So I made a script following a tutorial on yt to make a first-person view and movement but I ran into a problem causing my cam to spin around everywhere without my input I’ve tried to find a solution but I couldn’t find one exact to my problem. (also sorry if I didn’t choose the correct prefix)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FirstPersonCam : MonoBehaviour
{
public float sensX;
public float sensY;
public Transform orientation;
float xRotation;
float yRotation;
private void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
//get mouse input
float mouseX = Input.GetAxisRaw(“Mouse X”) * Time.deltaTime * sensX;
float mouseY = Input.GetAxisRaw(“Mouse Y”) * Time.deltaTime * sensY;
yRotation += sensX;
xRotation -= sensY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
//rotate cam and orientation
transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
orientation.rotation = Quaternion.Euler(0, yRotation, 0);
}
}

These tutorials are outdated. Nobody scripts standard camera behaviour anymore since this is built into Cinemachine. Unity‘s free „First/Third Person Starter Assets“ provide a minimal example and there are also Cinemachine specific tutorials.

Oh ok thanks a lot so I need to find another tutorial essentially ok fair thanks for the help

using UnityEngine;
public class FirstPersonCam : MonoBehaviour
{
    public float sensX;
    public float sensY;
    public Transform orientation;
    float xRotation;
    float yRotation;
    private void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }
    private void Update()
    {
        float mouseX = Input.GetAxisRaw("Mouse X") * sensX;
        float mouseY = Input.GetAxisRaw("Mouse Y") * sensY;
        yRotation += mouseX;
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
        transform.localRotation = Quaternion.Euler(xRotation, 0, 0);
        orientation.rotation = Quaternion.Euler(0, yRotation, 0);
    }
}