Springs for a turret

https://gyazo.com/7bfb34b7da16abf803aa67b60d71db1f

I want to achieve a spring module that I can use to apply a force on that turret head and then it goes [RECOIL SYSTEM]

For my system I need a 1D spring to only adjust the z offset for that turret head, I used many modules but they all shove the spring to a target instead of just it going to it’s normal place

Here is the module I Used to make the gyazo

function real_Spring.new()
	local self = {}
	setmetatable(self,real_Spring)
	self.Force = 0
	self.k = .25
	self.Dx = 0
	self.Position = 0
	self.Velocity = 0
	self.Target = 0
	self.Friction = .025
	return self
end

function real_Spring:Shove(num)
	self.Target = num
end

function real_Spring:Update(dt)
	local dx = self.Target-self.Position
	self.Force = (self.k*dx)
	self.Velocity += (self.Force) * self.Friction
	self.Position+=self.Velocity
	return self.Velocity
end