How do I make a player limp when walking?

The goal I need to achieve is to make the player limp (this regulates the intensity of limping) when walking. I imagine it this way: the player will slow down when walking (if necessary, for greater aesthetics, you can also slow down the camera), and then there will be a jerk that will return the previous values. However, this is quite difficult, since the player’s speed can change during the sprint, so how can this be implemented?

RNS.RenderStepped:Connect(function()
	local velocity = math.round(Vector3.new(HRP.AssemblyLinearVelocity.X, 0, HRP.AssemblyLinearVelocity.Z).Magnitude)

	if velocity > 0 then
		camera.CFrame *= CFrame.new(0, GetCurve(verFrequency, verIntensity) * velocity / defWalkSpeed, 0) * CFrame.Angles(0, 0, math.rad(GetCurve(rotFrequency, rotIntensity) * velocity / defWalkSpeed))
	end
end)

I’m not sure how you could approach this using RenderStepped, I would just make a system that detects footsteps and rotates the CFrame based on a debounce consisting of left and right.

If anything, this is a script for rotating the camera when walking. And the steps can be detected by probably getting the maximum camera tilt to the left and right.

Not an exact answer but more of a suggestion, you could add some randomness via math.random or math.noise to the limp

Lameness is enabled only when the appropriate value is set. Well, this is basically a good solution, but how to determine the maximum tilt of the camera to the right or left?