I have a camera sequence script that I wanted to lock the player’s camera to once they enter the game. After that, I wanted the script to wait 20 seconds before transitioning to the next camera (PartB) using sine; the script would then finish. However, the script only works once the camera is locked to the camera part in the workspace (PartA); otherwise, the camera will not transition and will remain locked to PartA. I believe there is an easy fix for this, but I can’t seem to find it.
This is my script, I have in StarterGui.
local part = game.Workspace.PartA
local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.CurrentCamera
while true do
wait()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part.CFrame
end
wait(10)
local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection)
Camera.CFrame = StartPart.CFrame
local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame})
Cutscene:Play()
wait(Duration)
end
local function Cutscene()
MoveCamera(game.Workspace.PartA, game.Workspace.PartB, 5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
wait(.5)
Camera.CameraType = Enum.CameraType.Custom
Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
end
Cutscene()