Argument 3 missing or nil

Line 96 seems to be messing up my viewmodel for an FPS game.
it says that “Argument 3 missing or nil”

local humanoid = character:WaitForChild("Humanoid")

	
	if humanoid then
		local bobOffset = CFrame.new()
		
		if humanoid.MoveDirection.Magnitude > 0 then
			if humanoid.WalkSpeed == 18 then
--line 96 below
				bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()*10) * 0.75,-humanoid.CameraOffset.Y/3, 0) * CFrame.Angles(0, math.sin(tick()* -4) * -0.25, math.cos(tick()* -4)* .05))
			elseif humanoid.WalkSpeed == 25 then
				bobOffset =  bobOffset:Lerp(CFrame.new(math.cos(tick()*10) * 0.1,-humanoid.CameraOffset.Y/3, 0)* CFrame.Angles(0, math.sin(tick()*-8)* -.05, math.cos(tick()*-8)*0.05))
			end
			
		else 
			bobOffset = bobOffset:Lerp(CFrame.new(0,-humanoid.CameraOffset.Y/3, 0), 0.1)
		end
		
		
		for i, v in pairs(camera:GetChildren()) do
			if v:IsA("Model") then
				v:SetPrimaryPartCFrame(camera.CFrame * swayCF * aimCF*bobOffset)

			end
			end
		end

Can you provide more info?

  • Where Exactly is Line 96?

Edit:

Ah, I see
You appear to have forgotten to add the Update Speed

bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()*10) * 0.75,-humanoid.CameraOffset.Y/3, 0) * CFrame.Angles(0, math.sin(tick()* -4) * -0.25, math.cos(tick()* -4)* .05), .1)
1 Like

line 96 is right below
if humanoid.WalkSpeed == 18 then

Line 96: bobOffset = bobOffset:Lerp(CFrame.new(math.cos(tick()*10) * 0.75,-humanoid.CameraOffset.Y/3, 0) * CFrame.Angles(0, math.sin(tick()* -4) * -0.25, math.cos(tick()* -4)* .05))

Oh thanks a lot! I have never even noticed that.

(I wish Roblox Studio’s output was more precise at detecting errors)

The Description of the function or thread usually tells you what you need to add, For Example:
CFrame:Lerp() (self: CFrame, goal: CFrame, alpha: number): CFrame

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.