I dont know how to fix this?

Hello, when trying to achieve CFrame Tween for my loading screen I get the same error which I don’t know how to fix. Can anyone help?

My error:

The Script:

It says something is wrong within line 57. I’m not sure what it is… Help is very appreciated!


local camera = Instance.new("Camera", vf)
camera.FieldOfView = 40
local me = script.Parent.ViewportFrame["Put in"]

 local s = script.Parent:WaitForChild("bass")
s:Play()
local base = me.Head.Position
local ba = me.Head.CFrame

local bos = script.Parent.Parent:WaitForChild("text").Position


local bo =script.Parent.ViewportFrame["Put in"].Head.Position





local n =0
local n2 =0

game:GetService("RunService").RenderStepped:Connect(function()
	n = n+.07
n2 = n2-.14
	local am = math.cos(n)
local am2 = math.cos(n2)*1.5	

me:SetPrimaryPartCFrame(ba*CFrame.new(0,am2,0)* CFrame.Angles(0,math.rad(90),0) )
local cameraPosition = bo  + Vector3.new(-3.5,0,am*2)	


script.Parent.Parent:WaitForChild("text").Position = bos + UDim2.new(0,-am*200,0,am2*14-10)

camera.CFrame = CFrame.new(cameraPosition, me.Head.Position +Vector3.new(0,0,am/5)) 
script.Parent.ViewportFrame.CurrentCamera = camera

end)
function lerp(a, b, t)
    return a * (1-t) + (b*t)
end
game:GetService("RunService").RenderStepped:Connect(function()
local now = lerp(workspace.Camera.FieldOfView,40- s.PlaybackLoudness/14,.3)
	
	workspace.Camera.FieldOfView = now
end)




workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera:Interpolate(workspace.Campost:FindFirstChild(1).CFrame,workspace.Campost:FindFirstChild(1).CFrame*CFrame.new(0,0,-1),.1)
while wait(1.5) do
for i = 1,13 do
	wait(3)
workspace.CurrentCamera:Interpolate(workspace.Campost:FindFirstChild(i).CFrame,workspace.Campost:FindFirstChild(i+1).CFrame,4)
end	
end
me.Parent:Destroy()
2 Likes

Your Camera Mode needs to be scriptable in order to use interpolation. Learning how to read errors is a very useful skill, and I will definitely remove some confusions in the future.

edit: oops

1 Like

You need to set the CameraType to scriptable before you can move it from a script

Before the animation:

camera.CameraType = Enum.CameraType.Scriptable

After the animation:

camera.CameraType = Enum.CameraType.Custom
3 Likes

Which line would I put this on?

So where would I put this? I’m a beginner so I wouldn’t know… Sorry

You already have
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable.

I’m guessing this is the line that is erroring. If that is the case, you might be changing workspace.CurrentCamera.CameraType in some other script while the game is running.

Try Ctrl + Shift + F and search for “CameraType”.

1 Like

It seems like I am in my menu manager. I use camera.CameraType = Enum.CameraType.Scriptable

2 Likes