Spring module keep building up

see it here: MW2022 - Roblox
i can give a video because my computer recording sux

local module = {}

function module.update(viewmodel, dt, RecoilSpring, LandSpring,JumpSpring, BobbleSpring, SwayingSpring,gunbobcf,Breathcf,C,RunningOffset)
	viewmodel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame * gunbobcf * Breathcf * C * RunningOffset)

    local MouseDelta = game:GetService("UserInputService"):GetMouseDelta()

	local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
	
	SwayingSpring:shove(Vector3.new(-MouseDelta.X / 500, MouseDelta.Y / 200, 0))
	
	Character.Humanoid.StateChanged:Connect(function(oldState, newState)
		if newState == Enum.HumanoidStateType.Jumping then
			JumpSpring:shove(Vector3.new(0,.003,0))
		elseif newState == Enum.HumanoidStateType.Landed then
			LandSpring:shove(Vector3.new(0,-.005,0))
		end
	end)

    local UpdatedRecoilSpring = RecoilSpring:update(dt)
    local UpdatedBobbleSpring = BobbleSpring:update(dt)
	local UpdatedSwaySpring = SwayingSpring:update(dt)
	local UpdatedLandSpring = LandSpring:update(dt)
	local UpdatedJumpSpring = JumpSpring:update(dt)

    viewmodel.HumanoidRootPart.CFrame = viewmodel.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(UpdatedBobbleSpring.Y, UpdatedBobbleSpring.X, 0))
    viewmodel.HumanoidRootPart.CFrame *= CFrame.new(UpdatedSwaySpring.X, UpdatedSwaySpring.Y, 0)

    viewmodel.HumanoidRootPart.CFrame *= CFrame.Angles(math.rad(UpdatedRecoilSpring.X) * 2, 0, 0)
	game.Workspace.Camera.CFrame *= CFrame.Angles(math.rad(UpdatedRecoilSpring.X), math.rad(UpdatedRecoilSpring.Y), math.rad(UpdatedRecoilSpring.Z))
	
	viewmodel.HumanoidRootPart.CFrame *= CFrame.new(0, UpdatedLandSpring.Y, 0)
	
	viewmodel.HumanoidRootPart.CFrame *= CFrame.new(0, UpdatedJumpSpring.Y, 0)
end

return module

thats the module.

SpringModule.lua (1.5 KB)
this is the spring module.
credit to: @BIackShibe

This is because you are not resting it when you want it to stop.

1 Like