CurrentCamera Script is doing basically nothing

try this?

local Players = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local OpeningPart = workspace.OpeningSceneCamera


     Camera.CameraType = Enum.CameraType.Scriptable
     Camera.CFrame = OpeningPart.CFrame
     wait()
     Camera.CameraType = Enum.CameraType.Default

It returned with the same predicament with the CameraSubject becoming the humanoid

I think I might have had this issue awhile ago.

Try this in StarterPlayerScripts:

local runService = game:GetService('RunService')
local function waitForCamera()
    repeat runService.RenderStepped:Wait() until workspace.CurrentCamera
    return currentCamera
end
local camera = waitForCamera()
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = workspace.OpeningSceneCamera

If not, it’s likely because the CameraSubject property of cameras don’t work when set to scriptable.

If your OpeningSceneCamera is a camera,

workspace.CurrentCamera = workspace.OpeningSceneCamera

If it’s a part,

workspace.CurrentCamera.CFrame = workspace.OpeningSceneCamera.CFrame

I think it may be because of scriptable, what mode could I use besides it? I just tried custom.

Custom is the default one and allows things like spectating.

Maybe try :BindToRenderStep? That’s what most devs use for camera manipulation IIRC.

local runService = game:GetService('RunService')

local function keepScriptable()
    workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
end

runService:BindToRenderStep('KeepScriptable', Enum.RenderPriority.Camera.Value + 1, keepScriptable)

Then if you need it to not be scriptable anymore,

runService:UnbindFromRenderStep('KeepScriptable')

It worked perfectly fine, thank you. Very useful thing to remember

1 Like