How to make the camera look at a part

The title says it all, the only solution I found was CFrame.lookAt but when I tried it I could still move the camera before it snapped back.

Setting Camera.CameraType to Scriptable will make it so the player can no longer move the camera.

local cam = workspace.CurrentCamera

cam.CameraType = Enum.CameraType.Scriptable

cam.CFrame = CFrame.lookAt(cam.CFrame.Positon, part.Position)
2 Likes

This is helpful but I still want the camera to follow the player

I’ve made a spectating system, and this is what I used to smoothly transition the camera to spectate players:

local cframe = self.SpectatedPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0, 1.5, 8)
self.Camera.CFrame = self.Camera.CFrame:Lerp(CFrame.lookAt(cframe.Position, self.SpectatedPlayer.Character.HumanoidRootPart.Position + Vector3.new(0, 1.5)), dt * 10)
1 Like