FPS Viewmodel jittery when moving

I am working on an FPS framework, but i’m having trouble with a jittery camera.
I have no problems when i look around without moving, but when i begin moving, their is a visible stutter in the movement of the viewmodel. I am using a spring module to create the sway.

I have tried to find a solution, and there are a couple of topics which have the same issue as I do, but i can’t seem to apply their solutions to my code.


The screen capture didn’t really pick up the stuttering, but it is very visible in-game

Spring Module code
    local spring = {}

function spring.new(position, velocity, target)
    local self = setmetatable({}, {__index = spring})

    self.position = position
    self.velocity = velocity
    self.target = target
    self.k = 1;
    self.friction = 1;

    return self

function spring:update()
    local d = (self.target - self.position)
    local f = d * self.k
    self.velocity = (self.velocity * (1 - self.friction)) + f
    self.position = self.position + self.velocity;

return spring

RenderStepped Function

local angles = CFrame.Angles(0, math.rad(90), 0)
local offset = CFrame.new(0, -1, 0)

positionSpring.target = (camera.CFrame * offset * angles).Position

local ax, ay, az = camera.CFrame:ToEulerAnglesXYZ()	
plrvp.HumanoidRootPart.CFrame = (CFrame.new(positionSpring.position) * CFrame.Angles(ax, ay, az) * angles)

Thanks in advance