Camera not focusing on part

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = cameraPart.CFrame

the player’s camera isnt set to the camera part when this code is executed, it’s a local script and theres no errors. I tweened the camera part and the part tweens without the camera attached

Is the LocalScript in the sub-properties of StarterPlayer? Because if not, I won’t work properly…

Its in a screenGui thats in a starter gui but last time I did something like this it worked in starter gui

Well, if it worked slightly in the ScreenGui, then that is a little bit okay… Although to have the Camera manipulated properly, it is essential to put it underneath in StarterPlayer > StarterPlayerScripts or StarterPack.

There is documentation talking about the customization in regard to the Camera that may help you further to understand how it works + its function:

check, is cameraPart anchored?

Is this only ran once? Because sometimes it’s set back to Custom automatically, you should run it in a loop.

-- workspace is an alternative to game.Workspace

for i = 1, 100 do -- only runs 100 times so its not infinite
    workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
    workspace.CurrentCamera.CFrame = CameraPart.CFrame

    task.wait()
end

Edit : Nevermind, I don’t think you should do this. Try this instead.

repeat
    workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
    workspace.CurrentCamera.CFrame = CameraPart.CFrame

    task.wait()
until workspace.CurentCamera.CameraType == Enum.CameraType.Scriptable
1 Like

local player = game.Players.LocalPlayer
local character = player.Character
local cameraPart = character.Head.CameraPart
local camera = game.Workspace.CurrentCamera
local humanoid = character.Humanoid
local deb = true

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = cameraPart.CFrame
camera.FieldOfView = 100

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Track

You have to set the CameraType back to Track at the end of your script.
local player = game.Players.LocalPlayer
local character = player.Character
local cameraPart = character.Head.CameraPart
local camera = game.Workspace.CurrentCamera
local humanoid = character.Humanoid
local deb = true

camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cameraPart.CFrame
camera.FieldOfView = 100

camera.CameraType = Enum.CameraType.Track