Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my camera script using CFrame not work when I test it out?

Asked by 4 years ago

I recently learned how to move cameras with TheDevKing but he didn't explain how to move a camera using CFrame so I tried to do it myself with the help of the roblox DevHub but it didn't work. Is there any error in my script that I need to change? The output showed no error. Thank you in advance.

Script:

1local cam = game.Workspace.CurrentCamera
2 
3local pos = Vector3.new(0, 100, 0)
4local lookAt = Vector3.new(100, 0, 0)
5local CameraCFrame = CFrame.new(pos, lookAt)
6cam.CFrame = CameraCFrame

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

Set the camera type to scriptable.

1cam.CameraType = Enum.CameraType.Scriptable
2cam.CFrame = CameraFrame

CameraType API Reference

Ad

Answer this question