Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't the CurrentCamera.CFrame work?

I've been wanting to make a camera intro, but I've never got to do it because my camera script does not work for some reason. I've even looked at the dev forums first (that's how I made my script), and I followed the instructions the best I could but it still didn't work.

This is the script:

local Camera = game.Workspace.CurrentCamera 

Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame

The script wont work, no warnings in output at all. Please help me, and thank you for reading my post.

10 comments

0

Camera apparently requires .CoordinateFrame

0

I tested and that doesn't work, but thank you anyway.

0

You also need to define CameraSubject. - Camera.CameraSubject = workspace.CamPart

0

How does that work?

0

It tell the Camera which part it's focusing on.

0

CoordinateFrame for the Camera's deprecated; it's the exact same thing as CFrame too.

0

Will this work? Camera.CoordinateFrame = CFrame.new(0,4,0)

0

You shouldn't be using CoordinateCFrame as it's deprecated, and does the exact same thing and purpose as Camera.CFrame.

0

use enums for the CameraType property, Enum.CameraType.Scriptable

0

Thank you everyone for helping me! I now can make a intro for my friend and me. Also i'm sorry for not verifying the answers because I had school.

2 answers

✓ Accepted answer

I was just stuck on this same problem yesterday! I see that you have made the block that the camera is inside. You called it CamPart. You need to make a "Focus" part, meaning the part that the camera will point at. When you have made that part to point at, use this script. This worked in my game called "Elucidate"

local Camera = game.Workspace.CurrentCamera

Camera.CameraType = ("Scriptable")
Camera.CFrame = CFrame.new(workspace.CamPart.Position, workspace.FocusPart.Position)

Local Script

local Camera = workspace.CurrentCamera 

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = workspace.CamPart
Camera.CFrame = workspace.CamPart.CFrame

Firstly, please make sure you are using a LocalScript, since the CurrentCamera is dependent on this.

Secondly, your original script only changes the camera's location (the focus will still be on the player), so if you want to move the camera to a new location that doesn't aim towards the player, then you can use the CameraSubject Property

Thirdly, do not use a String for an Enum (CameraType), since even though it will work some of the time, at some point it will break for a player and they will be unable to play your game correctly (esp. since this is for an intro)

Fourthly, you can call the Workspace directly using workspace instead of game.Workspace (Optional)

This discussion is preserved as it was. New answers, comments, and votes are closed.