Issues with creating custom first person camera

I’m trying to make my own custom Camera System and I’m having trouble implementing first person. I tried to add it by multiplying the camera cframe by a cframe.angles() generated with mouse delta but it causes the camera to occasionally rotate in weird angles and I have no idea how to stop the character from looking more than 90 degrees up. or down

this is literally all of the code related to camera

	local MD = UIS:GetMouseDelta()
	
	Cam.CFrame *= CFrame.fromOrientation(-MD.Y/1000,-MD.X/1000,0) 

Did you ever end up solving this issue? I’m trying to accomplish similar, but it keeps doing the tilt thing and it’s mad annoying!