When I walk, the viewmodel stays in place and only snaps back to the camera when I stop moving. I am trying to create a smooth walk animation but it does not want to obey.
CODE:
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
local bobOffset = CFrame.new()
if humanoid.MoveDirection.Magnitude > 0 then
if humanoid.WalkSpeed == 14 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))
elseif humanoid.WalkSpeed == 24 then
bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()* 8) * 0.1, -humanoid.CameraOffset.Y/3, 0) * CFrame.Angles(0, math.sin(tick() * -8) * -0.1, math.cos(tick() * -8) * 0.1))
end
else
bobOffset = bobOffset:Lerp(CFrame.new(0, -humanoid.CameraOffset.Y/3, 0), 0.1)
end