Camera CFrame will not change

I am making a game that requires the camera to be changed a lot. Everything is working fine from the custom camera it made to the security camera system.

There is supposed to be jump scares that I want to make by forcing the player’s camera to a certain position, but for some reason the method i have been using to change cameras no longer works.

The script is supposed to check if a BoolValue is true, and if it is, send the player camera CFrame to a part’s CFrame.
It is a local script, the camera is set to scriptable, and the value is changing as well as being detected by the script
The script is in the value, which is in the workspace, and this is what I have so far:

local Camera = workspace.CurrentCamera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")

Camera.CameraType = Enum.CameraType.Scriptable

while true do
	if script.Parent.Value == true then
		Camera.CFrame = DeathCam.CFrame
	end
	wait()
end

Any help would be appreciated, thank you!

Any errors? I can’t see anything jumping out as not working

No, there are not any errors. And when i put a print in that was working fine

Try workspace.Camera instead of current camera

Nothing has changed. Plus the camera is already defined in a variable

Try setting camera focus to the cframe/position of the deathCam

There is still nothing happening.

Try this:

local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")



while true do
	if script.Parent.Value == true then
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = DeathCam.CFrame
		Camera.Focus = DeathCam.CFrame
	end
	wait()
end

There is still nothing. No errors or anything

Are you sure the value is being set too true?
try it without checking the value

Also try this maybe it will work with

Enum.CameraType.Fixed

it is definitely being set to true. I tried putting the print back in though and now that won’t work

1 Like

That has also done nothing. If you can’t work it out then don’t worry

hmmm this is odd,
I have one more thing to try, This script removes the loop and just detects when the value changes

local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")




script.Parent.Value.Changed:Connect(function(value)
	if value == true then
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = DeathCam.CFrame
		Camera.Focus = DeathCam.CFrame
	end
end)

Nope, nothing has changed still

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = DeathCam
Camera.CFrame = DeathCam.CFrame

Local scripts don’t run on the server.
Make a local script in starterplayer scripts:

local Camera = workspace.Camera
local DeathCam = workspace.Views:FindFirstChild("ViewMain")
local MyBool=workspace.MyBool -- Point to your bool location

local function MoveCamera()
	
	if MyBool.Value==true then 
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = DeathCam.CFrame 
	end
end
	
MyBool.Changed:Connect(MoveCamera)
1 Like

That hasn’t changed anything. And there are still no errors

It worked! Thank you so much everyone for helping!

2 Likes