Ok so the solution might be super simple and I’m just blind
Here is the script:
local camera = game.workspace.Camera
local part = game.workspace.IntroCam
local Player = game.Players.LocalPlayer
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
wait(17)
camera.CameraSubject = Player.Character.Humanoid
camera.CameraType = Enum.CameraType.Custom
Very simple right? Yet it doesnt work and there are no errors!
The script is enabled, it is in startergui, and is a local script. What am I missing here?
local camera = game.Workspace.CurrentCamera -- current camera
local part = game.Workspace.IntroCam
local Player = game.Players.LocalPlayer
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
wait(17)
camera.CameraSubject = Player.Character:WaitForChild("Humanoid")
camera.CameraType = Enum.CameraType.Custom
local camera = game.workspace.CurrentCamera
--please make sure that you have a part named "IntroCam" in workspace
local part = game:GetService("Workspace"):WaitForChild("IntroCam")
local Player = game.Players.LocalPlayer
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
task.wait(17) --use task.wait insead of wait!
camera.CameraSubject = Player.Character.Humanoid
camera.CameraType = Enum.CameraType.Custom
Try adding prints in the script and see which print messages show in the output and which ones doesn’t. This is to see where the script could have stopped running its code.
Side note, use workspace not game.Workspace. It does the same thing except takes up less space and is slightly faster. Other than that, I see two issues here.
Change this to local camera = workspace.CurrentCamera.
The default camera scripts can load after your script; when they do they set the camera to Enum.CameraType.Custom which would break your script.
Solution
local camera = workspace.CurrentCamera
local part = workspace:WaitForChild("IntroCam") -- Waits for IntroCam to load. Ensures script doesn't break on slow internet or computers
local Player = game:GetService("Players").LocalPlayer -- Less likely to break than game.Players
local connection = nil
local function setcamera()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
end
setcamera()
connection = camera:GetPropertyChangedSignal("CameraType"):Connect(setcamera) -- Changes the camera type back to scriptable
task.wait(17) -- wait() is deprecated
connection:Disconnect() -- Disables connection so it cannot change the camera type anymore
connection, setcamera = nil, nil -- Deletes not-needed variables
camera.CameraSubject = Player.Character.Humanoid
camera.CameraType = Enum.CameraType.Custom