Making camera flick up when shooting a gun

The title says it all. I’m making a simple fps game, so I was wondering how I would make the player’s camera flick up when firing?

There could be a better way, but in this method, you’ll have to set the camera’s cframe to a part.

local UIS = game:GetService("UserInputService")
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.Part.CFrame

	if input.KeyCode == Enum.KeyCode.E then
		for i = 1,10,1 do
			workspace.Part.Orientation =,0,0)
			workspace.CurrentCamera.CFrame = workspace.Part.CFrame
function Recoil()
  local cam = workspace.CurrentCamera
  for i = 1, 10, 0.1 do -- mess with this if you want
    cam.CFrame = cam.CFrame:Lerp(cam.CFrame * CFrame.Angles(0, i, 0))
    task.wait() -- or you can replace this with RunService.RenderStepped:Wait()

I think this should work, just call this function every time the player shoots.
“for i = 1, 10, 0.1 do” basically makes “i” equal to 1, and “i” will increase by 0.1 until it reaches 10