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

Camera isn't focusing on an object via lookVector? [closed]

local camera = game.Workspace.CurrentCamera
camera.CameraSubject = workspace.cameraPart
camera.CameraType = "Scriptable"
camera.CFrame.lookVector = CFrame.new(workspace.cameraFocus.Position) --focuses on a part

(its 2AM here so my coding is stupid lol)

All I'm trying to do is set the character's camera to a part, and have that part (that is set as the users camera) to focus on a part thats further away.

I might be overcomplicating this. Once again, 2AM coding is absolute hell

1 answer

✓ Accepted answer

You cannot change the lookVector property of CFrames as it is read only. Changing Camera.Focus won't work either; Roblox prevented that with an update a long time ago.

What you can do is use this CFrame constructor:

local camera = game.Workspace.CurrentCamera

camera.CFrame = CFrame.new(positionVector, lookAtVector)

Which constructs a brand new CFrame object with position positionVector and which points to lookAtVector.

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