Camera Type won't change

So what I have a problem with is that when I want to from Camera Type “Scriptable” to change it to “Custom” like a transition, it doesn’t work. But for Roblofield (my other project) it does work. I need a fast answer for this. Here’s the script:

local frame = script.Parent.Parent.Parent.FrameMain
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)
local Camera = game.Workspace.CamPart
local ClickSFX = script.Parent.Parent.Clicker
local dofeffect = game.Lighting.DepthOfField
dofeffect.FarIntensity = 0.75
dofeffect.FocusDistance = 0.05
dofeffect.InFocusRadius = 10
dofeffect.NearIntensity = 0.75
dofeffect.Enabled = true

script.Parent.MouseButton1Click:Connect(function()
ClickSFX:Play()
frame:TweenPosition(UDim2.new(-0.5, 0,0.28, 0))
wait(0.5)
Camera.CameraType = "Custom"
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,true)

dofeffect.FarIntensity = 1
dofeffect.FocusDistance = 53.42
dofeffect.InFocusRadius = 50
dofeffect.NearIntensity = 1
end)

That was main script, this is the manipulator:

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer

repeat wait() until Player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame
script.Parent.Enabled = true

Everything works perfectly beside Camera Type change. I saw that no other GUI did affect it. Stays the same.

I’ve had similar problems when trying to do similar stuff like just change the CameraType. This is probably just because the camera isn’t properly loaded yet. I’d try a wait(5) to see if that’s your issue, and then do something like game.Workspace:WaitForChild(“CurrentCamera”)

I don’t understand that part? What we’re you trying to say?
Also, that was not a problem, My other project had like 1,2 seconds wait time, and it worked.

:WaitForChild() waits for a child that you’d expect to be there to be there. So you’d replace your current definition of the Camera with that.
local Camera = game.Workspace:WaitForChild("CurrentCamera")
Since it may take some time to load, I would recommend you do this in general with most things that take time to load in (which is pretty much everything, unless you’re trying to get something like script.Parent, because the parent of a script would have to be loaded for the scripts to be loaded)

Well, I replaced the definition. It did set the custom immediately, not when I clicked the button…

I believe you’re talking about your first block in the original post?

This is because this “camera” you define in this part is not the default camera. I’m guessing this is a part you created. Also, the reason it the CameraType starts at “Custom” is because that’s the default.

You’d probably want to call your “camPart” variable “camPart”, and call your “camera” “Camera”

1 Like

In your main script you are setting camera to:

local Camera = game.Workspace.CamPart

I’m going to assume that CamPart is a part, then you try to change that part’s camera type.

Camera.CameraType = "Custom"

Only workspace.CurrentCamera has the property of CamerType.

So, to fix your script change:

local Camera = game.Workspace.CamPart

To:

local Camera = workspace.CurrentCamera

Thank you so much my dear friend. You don’t know how much this helped me!