Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make this Interpolating work?

How do I make the interpolate work and not doing nothing? none of the variables are nil btw

local Camera = Game:GetService("Workspace").CurrentCamera
local Focus1 = CP:WaitForChild("Focus1").Position
local Pos2 = CP:WaitForChild("Pos2").Position
local HRP = Character:WaitForChild("HumanoidRootPart")

coroutine.resume(coroutine.create(function()
	print("a")
	Camera.CameraType = 6 -- Scriptable
	print("b")
	Camera:Interpolate(HRP.CFrame, Foc1, 2)
	print("c")
	wait(2)
	Camera:Interpolate(Pos2, Foc1, 15)
	print("e")
	
end))

the script stops at b and then doesnt do anything

1 comment

0

Tip: You can use the value "Scriptable"instead of 6 when setting CameraType so that your code is more readable and self-explanatory! (Or the pedantic Enum.CameraType.Scriptable)

1 answer

You haven't defined Foc1; the variable you made was named Focus1, so indeed, Foc1 is actually nil.

However, Focus1 and Pos2 still are problems since the Interpolate method requires CFrame values, not Vector3 values.

You can make a new CFrame with the default orientation as a position p using CFrame.new(p).

This discussion is preserved as it was. New answers, comments, and votes are closed.