Hello. I’m currently making a gun system and trying to make the players camera tween down after shooting (to counter the recoil). It works great when stationary but when moving the camera stays in the same position for half a second before going back into place. I apologise for the poor explanation im not very good at explaining things but I’ve attached a video below to better explain.
Its a very simple script but I can’t figure out a fix.
local function cameraRecoil()
camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(2.5),0,0)
TweenService:Create(
camera,
TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
false,
0
),
{CFrame = camera.CFrame * CFrame.Angles(math.rad(-2.5),0,0)}
):Play()
end
Thats what gives the recoil. The tween is for making the camera slowly go down after. Also would like to add that you cant move the camera during the tween as well which is frustrating.
If you need the camera to go back, then you need to use something different than tween. It would be better if you had your own system for handling the camera to go down. Maybe make a variable that says how much the camera should go down and then every frame make the camera go down until the variable is zero.
Just add the amount of recoil to that variable in the cameraRecoil function.