Viewmodel does not update position constantly when using Lerp

local humanoid = character:WaitForChild("Humanoid")
if humanoid then
local bobOffset = CFrame.new()

	if humanoid.MoveDirection.Magnitude > 0 then
		if humanoid.WalkSpeed == 13 then
			bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()* 4) * 0.05, -humanoid.CameraOffset.Y/3, 0) * CFrame.Angles(0, math.sin(tick() * -4) * -0.05, math.cos(tick() * -4) * 0.05))
			isSprinting = false
		elseif humanoid.WalkSpeed == 18 then
			bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()* 8) * 0.1, -humanoid.CameraOffset.Y/3, 0) * framework.module.sprintCF)
			isSprinting = true
		end

	else
		bobOffset = bobOffset:Lerp(CFrame.new(0, -humanoid.CameraOffset.Y/3, 0), 0.1)
		isSprinting = false
	end
end

(this is in RenderStepped)
For some reason when lerping the viewmodel position, it does not constantly update with the camera position and stays in place, only to snap back into camera view when Im not moving.

Yeah it’s getting really annoying. I appreciate any help.

Why are the walkspeeds 13 and 18? Are they set walkspeeds for walking and sprinting?

Also, are you recieving any errors?

This line should error since it has no 2nd argument to the Lerp function.

same with this line

however

This is fine because it sends a CFrame and a number, which is 0.1, to the Lerp function.

that line of code runs if the humanoid walkspeed reaches that value. Also there are no errors in the code.

May you please point out where am I missing the 2nd argument? Also there are no errors in the code.



Notepad++ tells me what your parathesis are including
You’re doing :Lerp(CFrame.new( stuff here ) * CFrame.Angles( stuff here ))
Which will result in just passing a single CFrame and no number value (percent value).


This error looks strange but the Lerp function looks like this:

CFrame1:Lerp(CFrame2, delta)

Which is passing the parameters CFrame1, CFrame2, delta to the Lerp function.
In the code I ran only did

workspace.from.CFrame:Lerp(workspace.to.CFrame)

Which is only passing CFrame1 and CFrame2.