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

Simple camera manipulation?

So, I'm making a menu gui and I want a camera to look at a certain hallway. I want it to be type scriptable so users cant pan the camera, but I'm running into multiple issues.

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
  1. The camera is still able to pan, even though it is scriptable
  2. I have no idea how to position it

Any help would be amazing. Thanks!

1 answer

Simple problem, I had trouble with it once too. Here's what you do:

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = target.CFrame

The "Scriptable" CameraType does not work with CameraSubject. You need to use the CoordinateFrame property instead. CFrame is short for CoordinateFrame. So instead of using camera.CameraSubject use camera.CoordinateFrame and instead of putting "target" or the subject you want, use target.CFrame. If you want to edit the positions with it, do this:

local target = workspace.CameraPart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = CFrame.new(target.CFrame.X + number,target.CFrame.Y + number,target.CFrame.Z + number)

edit the "number"s to what you want.

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