Im making a gun system and I want to make realistic recoil for automatic weapons, right now it only springs the camera to one position for the duration that you are firing. I want to make it so that your recoil will increase the longer you fire but, make it so there is a limit to how much it increase by. Here is my current code:
local function onRenderStepped(deltaTime: number)
if shooting then
RecoilSpring:shove(Vector3.new(recoil, 0, 0.05) * deltaTime * 60)
task.delay(0.1, function()
RecoilSpring:shove(Vector3.new(-recoil, -0, -0.05) * deltaTime * 60)
end)
end
local recoil = RecoilSpring:update(deltaTime)
camera.CFrame = camera.CFrame * CFrame.Angles(recoil.X, recoil.Y, recoil.Z)
end