Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this Interpolating work?

Asked by 10 years ago

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

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) BlueTaslem 18071 — 10y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

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).

Ad

Answer this question