Mouse Look Script

I found this video about mouse look command

It works on video but not working on my project. Is it some problem about unity version?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class karakter_kontrol : MonoBehaviour
{
public float sens = 100f;
public Transform body;
float xrotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}

void Update()
{
    float mouseX = Input.GetAxisRaw("Mouse X") * sens * Time.deltaTime;
    float mouseY = Input.GetAxisRaw("Mouse Y") * sens * Time.deltaTime;

    xrotation -= mouseY;

    transform.localRotation = Quaternion.Euler(xrotation, 0f, 0f);
    body.Rotate(Vector3.up * mouseY);
}

}

For the reversed look up and down just try changing this xrotation += mouseY;.
I then suspect you have to make the body a parent of the maincamera which this script is attached to.