Gun Camera Recoil?

At the moment I am trying to make my camera tilt upwards slightly and then go right back down, just like gun recoil. I currently have this:


This looks exactly like I imagined, until you start moving the mouse or trying to move your character:

(This was me wildly moving the mouse all over the screen. Notice how the camera won’t rotate sideways?)

I have come to the conclusion that tweening will lock the camera from moving at all, which is undesirable. My current code is this:

local recoil = Vector3.new(0.3, math.rad(1), math.rad(math.random(-1, 1) * 0.1))
local intensity = 3

TS:Create(camera,TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{CFrame = camera.CFrame * CFrame.fromEulerAnglesYXZ(recoil.Y*intensity, recoil.Z*intensity,0)}):Play()

If anyone knows of a nice efficient way I can do recoil for guns, it would be greatly appreciated! :grin:


I am attaching a better video of the issue. Notice how the camera just gets locked to its current position and rotation.