Camera movement and gun follow in unity

I am making an fps and I have a lot of things down, but I really cant make it so the camera moves with your mouse movement + the gun following your camera movement (on X and Y) Thanks!

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

public class MouseComponent : MonoBehaviour
    public float MouseSensitivity = 500f;

    public Transform PlayerBody;

    float Xrotation = 0f;

    //Start is called before the first frame update
    void Start()
        Cursor.lockState = CursorLockMode.Locked;
    // Update is called once per frame
    public void Update()
        float MouseX = Input.GetAxis("Mouse X") * MouseSensitivity * Time.deltaTime;
        float MouseY = Input.GetAxis("Mouse Y") * MouseSensitivity * Time.deltaTime;

        Xrotation -= MouseY;
        Xrotation = Mathf.Clamp(Xrotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(Xrotation, 0f, 0f);

        PlayerBody.Rotate(Vector3.up * MouseX);


Attach script to camera and set the playerbody as the gameobject that your character controller is sitting under