The problem
I am creating a recoil system for my gun. In first person is works totally normal but in third person it has this bump to it every time I fire it. It is like the camera is going up and then suddenly goes down again.
Here is a video in first person how it should be:
https://gyazo.com/9bdafcc8bf81f90cee5cd734ca0091c7
Here is a video demonstrating the issue.
https://gyazo.com/2b678855bec023f9f2f09bc96f1bb3fe
I tried looking in the devforum but to my knowledge no one has had this issue before or posted about it.
Here is the script:
local effects = {}
local connection
local runservice = game:GetService("RunService")
function effects.VerticalRecoil(Camera, duration, amount)
connection = runservice.RenderStepped:Connect(function(DeltaTime)
local x = 1/(60*duration)
Camera.CFrame = Camera.CFrame:Lerp(Camera.CFrame * CFrame.Angles(math.rad(amount), 0,0), x)
print(x)
end)
task.wait(duration)
connection:Disconnect()
print("disconnect")
end
return effects