Camera.CFrame not working [CLOSED]

Hello. So currently I am trying to change the CFrame of the camera for a cutscene. But the camera is not moving to the CFrame that I need. Thanks.

Here is my code:

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = CFrame.new(-359.210663, 28.3838062, -86.6092911, -0.159699306, 0.270362616, -0.949420929, -3.7252903e-09, 0.961764514, 0.27387765, 0.987165689, 0.0437380746, -0.153593123)

Why all the different values in the cframe section?

That’s the CFrame I’m trying to move the camera to.

oooo. right. before all that code, you might wanna add this:

repeat wait() until game.Workspace.CurrentCamera.CameraSubject ~= nil

That would be assuming that I want to change the camera position as soon as the player joins the game. This is for a cutscene. I’ll try it anyway.

What are you trying to achieve? Is this a local script or something you are running in the studio command bar?

I’m trying to make an “Exiting” cutscene for a portal. Like when they exit the portal the camera will move to the CFrame. And it is a local script.

The code did not work. Thanks anyway though!

You may want to set the CFrame in a RenderStepped loop ?

When would that trigger? Because if I understand that right that will move it right after the game starts.

make sure you put this in a local script inside of StarterGui. StarterGui is where you handle the camera.

Alright. I’ll try a bindable function to trigger it from StarterGui. Thanks!

1 Like

That didn’t work. I’m sorry for the trouble. Thanks for the help!

how did you bind the function?

Script 1:

game.ReplicatedStorage.MoveCamera:Fire()

Script in StarterGui:


game.ReplicatedStorage.MoveCamera.Event:Connect(function()
	
	game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
	game.Workspace.CurrentCamera.CFrame = CFrame.new(-359.210663, 28.3838062, -86.6092911, -0.159699306, 0.270362616, -0.949420929, -3.7252903e-09, 0.961764514, 0.27387765, 0.987165689, 0.0437380746, -0.153593123)
	
end)

so are you trying to set the camera’s CFrame when the player loads in the game?

No. So I am making a portal transportation system and I want to move the camera after they exit the portal.

So Would I just delete those last 9 numbers?