Argument 3 missing or nil - Cframe/Lerp

INTRO

So I’m working on making a new intro GUI for my game - I’ve got the tweenservice setup for all of the frames, now I just need to finish the moving camera (background of GUI) - so I can proceed to redesign the rest of our UI’s & GUI’s

GOAL

To have the camera rotate while moving to give a more immersive effect when inititally joining the game.

PROBLEM

Argument 3 missing or nil occurs in dev console - and nothing is happening to the camera; although it does update to the designated part that is to act as the cframe.

Section of script that includes this function

function updateCamera()
	camera.CFrame = game.Workspace.MenuCamera.CFrame
	
	for i = 0, 1, .01 do

		camera.CFrame = camera.CFrame:Lerp(CFrame.new(76.934, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0, i))

	end

	wait (3)
	for i = 0, 1, .01 do
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(32.884, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0, i))

	end

	wait (3)
	for i = 0, 1, .01 do
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(32.884, 19.422, -135.431) * CFrame.Angles(0, math.rad(45), 0, i))

	end

	wait (3)
end

Why did you put the i variable inside CFrame.Angles parameters?

I see what you mean - I’m a bit uneducated with lerp; I referred to some off-site tutorial for it which told me to have it that way.

I have updated it since then, with this being the new code - however it doesn’t transition to the new position + rotation now, and does not display any errors

function updateCamera()
	for i = 0, 1, .01 do

		camera.CFrame = camera.CFrame:Lerp(CFrame.new(76.934, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)

	end

	wait (3)
	for i = 0, 1, .01 do
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(32.884, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)

	end

	wait (3)
	for i = 0, 1, .01 do
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(32.884, 19.422, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)

	end

	wait (3)
end

Add game["Run Service"].RenderStepped:Wait() in the loops so it doesn’t run instantly.

RenderStepped is what connects UpdateCamera

function updateCamera()
	local newcam = game.Workspace.MenuCamera
	camera.CFrame = newcam.CFrame
	
	for i = 0, 1, .01 do
		
		newcam.CFrame = newcam.CFrame:Lerp(CFrame.new(76.934, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)

	end
	wait(1)
	for i = 0, 1, .01 do
		newcam.CFrame = newcam.CFrame:Lerp(CFrame.new(32.884, 28.922, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)
		
	end
	wait(1)
	for i = 0, 1, .01 do
	newcam.CFrame = newcam.CFrame:Lerp(CFrame.new(32.884, 19.422, -135.431) * CFrame.Angles(0, math.rad(45), 0),i)
	end
	wait(1)
	end


game:GetService("RunService").RenderStepped:Connect(updateCamera)

After an embarrassing amount of time needed - I found the solution with the following results:

wait (5)
blur.Size = 20
	local posit0 = game.Workspace.Posit0
	local posit1 = game.Workspace.Posit1
	local posit2 = game.Workspace.Posit2
	local posit3 = game.Workspace.Posit3

	camera.CameraType = "Scriptable"
	camera.CFrame = posit0.CFrame

	wait(3)

	for i = 0, 1, .01 do
		wait()
		camera.CFrame = posit0.CFrame:Lerp(posit1.CFrame,i)

	end
	wait(1.25)
	for i = 0, 1, .01 do
		wait()

		camera.CFrame = posit1.CFrame:Lerp(posit2.CFrame,i)

	end
	wait(1.25)
	for i = 0, 1, .01 do
		wait()

		camera.CFrame = posit2.CFrame:Lerp(posit3.CFrame,i)
	end
1 Like