How to make the camera like in FNAF?

Hello, i want to make a FNAF fan-game but i don’t know how to do this thing:

When you move your cursor to the left, it smoothly rotates the camera to the left side and when you move your cursor to the left, it smoothly rotates the camera to the right side.

do you have a video that shows this so we know what your talking about. i dont know what fnaf is (do you mean five nights at freddy’s)

yes, five nights at freddy’s

I have never played FNaF but based on your description,
I would just get the Mouse’s screen position distance from center, then lerp the camera rotation until it’s pointing at the same place in the world that the cursor is.

But then there’s a problem where the mouse is still where you put it, not moving with the camera and so the camera never catches up with the mouse and you spin forever. Maybe it is best to hide the cursor and use the input axis using Mouse X and Y to move a cursorlike widget as if it is on the screen, and then lerp camera rotation to match its position.

Another way of saying it:
The “Cursor” could be a billboard component that has its pivot point centered on the camera but the displayed component part is out in front of the camera. Rotating the component would then move the “cursor” around the camera’s field of view as if it was on the screen space, and the camera can gradually adjust rotation every tick, making smaller adjustments as the difference in rotations becomes smaller so it smoothly slows down to settle into place, centered over the “cursor”.

Never tried this but that’s the first idea that comes to mind.

Does anyone have a more clean and elegant solution?

Another way could be to have the player pawn always have the “cursor” centered in front of the pawn’s direction, but the camera is on a spring arm with Camera Lag enabled, and then you simply rotated the pawn with the mouse Axis inputs.