Recoil going down istead of up with Spring Module

so i been working so a recoil function for my fps game, and i run into a slight problem.

so the problem that im facing is that the recoil after every shot goes down very slightly. ive been absolutely stumped on what could be causing this or on how to fix it.

ive been stuck on this for a while now any any information or help on how to fix this would be appreciated

example 1, you can just barely see that it goes down every time:

example 2, i changed the rmp of the gun to be way higher, and you can see the problem now

the recoil code

local spring = require(game.ReplicatedStorage:WaitForChild("spring"))
local camera = workspace.CurrentCamera
local recoilStrength = Vector3.new(0.1, 100, 0) 
local recoilReturnSpeed = 0.5
local recoilSpring = spring.new(Vector3.zero) 

local function recoil()
	local horizontalOffset = math.random(-recoilStrength.X * 10, recoilStrength.X * 10) / 10
	local verticalOffset = recoilStrength.Y
	local recoilForce = Vector3.new(horizontalOffset, verticalOffset, 0)
	recoilSpring:shove(recoilForce)
end

game:GetService("RunService").RenderStepped:Connect(function(dt)

	recoilSpring:update(dt * recoilReturnSpeed)


	local recoilOffset = CFrame.Angles(
		math.rad(recoilSpring.Position.Y),
		math.rad(recoilSpring.Position.X),
		0
	)
	camera.CFrame = camera.CFrame * recoilOffset
end)

game:GetService("RunService").RenderStepped:Connect(function(dt)

	recoilSpring:update(dt * recoilReturnSpeed)


	local recoilOffset = CFrame.Angles(
		math.rad(-recoilSpring.Position.Y),
		math.rad(recoilSpring.Position.X),
		0
	)
	camera.CFrame = camera.CFrame * recoilOffset
end)
1 Like