I have a CameraPart as a camera, and a local script in StarterGui
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera function onCutscene() wait(19) repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CFrame == workspace.CameraPart.CFrame Camera.CFrame = workspace.CameraPart.CFrame end onCutscene()
And inside CameraPart, I have a script
CameraPart = script.Parent function onCutscene() wait(19) for i = 1, 2000 do CameraPart.Position.Y = CameraPart.Position.Y + 0.2 wait(0.01) end end onCutscene()
My intention is after 19 seconds, the camera's position will the CameraPart's position and it will go forward for 20 seconds, sort of like a cutscene. What are my errors and how can I correct them? Thanks in advance.
The problem is in your first script, you made a mistake
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera function onCutscene() wait(19) repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CFrame == workspace.CameraPart.CFrame -- mistake here Camera.CFrame = workspace.CameraPart.CFrame end onCutscene()
should be
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera function onCutscene() wait(19) repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraPart.CFrame end onCutscene()
You should also use waitforchild