How to change to the default camera CFrame from a script?

Hey dev’s. I am making a little nightmares inspired game on roblox and i want boss fights. but i don’t know how to change the camera’s CFrame to the default one. Please Help.

The LocalScript:

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

player.CharacterAdded:Wait()
player.Character:WaitForChild(“HumanoidRootPart”)

local function GameCamera()
camera.CameraSubject = player.Character.HumanoidRootPart
camera.FieldOfView = 70
end

local function BossCamera()
camera.CameraSubject = player.Character.Humanoid
camera.FieldOfView = 70
end

game:GetService(“RunService”).Stepped:Connect(function()
if camera.CameraType == Enum.CameraType.Attach then
GameCamera()
camera.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position) * CFrame.new(0,3,18)
else
BossCamera()
– This is where the default camera CFrame will be. [I already tested it another way]
end
end)

When the camera type is Custom, the camera is stuck in the air facing the ground.

PS : The script is in StarterPlayerScripts

Have you tried to use Enum.CameraType.Fixed ? That is usually the default.

For your modified camera, I would use Enum.CameraType.Scriptable.

This probably isn’t the best way but if at the beginning of the script the CFrame is normal you can do something to save it, I’ve done something similar but with size for a blinking system since different characters have different size eyes.

local cameraOrigin = camera.CFrame

thanks for trying to help me.
it sadly does not work. its still the same bug.

Also if you don’t know, to use it do:

camera.CFrame = cameraOrigin

everything i try is the same bug.

Are you still using the previous conditional statement:

if camera.CameraType == Enum.CameraType.Attach then
GameCamera()

Ps: Are you setting the CameraType at all? If so, please paste that line.

oh yeah im not sending the cameratype in the local function.

It’s because if i want to make a cutscene, i make the cameratype scriptable and then attach when the cutscene is done. or if its a boss fight cutscene i make it custom instead of attach.

What do you mean by that? what bug is it

You may have typed something wrong, it should work. Try looking for errors it gives
Also try this:

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local cameraOrigin = camera.CFrame

player.CharacterAdded:Wait()
player.Character:WaitForChild(“HumanoidRootPart”)

local function GameCamera()
camera.CameraSubject = player.Character.HumanoidRootPart
camera.FieldOfView = 70
end

local function BossCamera()
camera.CameraSubject = player.Character.Humanoid
camera.FieldOfView = 70
end

game:GetService(“RunService”).Stepped:Connect(function()
if camera.CameraType == Enum.CameraType.Attach then
GameCamera()
camera.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position) * CFrame.new(0,3,18)
else
BossCamera()
camera.CFrame = cameraOrigin 
end
end)

i think i know how to fix it, the local script is named CameraScript. so it deletes the original one. so i need to name the script “CameraScript2”

you know what, the boss fights will be 2D then. i cant fix it