Currently I am working on a roblox game which requires some camera manipulations. The problem starts whenever I try to set camera type to scriptable:
local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable
The above would run without any errors while when looking in workspace camera type property would somehow change back to Custom (I imagine it has something to do with roblox's core camera script). It is also proven by the fact that the camera zoom functionality still works as where it shouldn't.
I know that certain camera types, e.g. watch, require proper cameraSubject, otherwise they won't work at all, but it shouldn't be the case with scriptable now should it.
So, the final question is: why can't I simply set the cameraType to scriptable and it actually stay as scriptable?
Additional question would be: which camera types support camera.CFrame, because I'm trying to make camera be in set position while the type being watchable which doesn't really work:
camera.CameraSubject = game.Players.localPlayer.character.Humanoid camera.CameraType = Enum.CameraType.Watch camera.CFrame = CFrame.new({custom position})
..the camera is set as watch but is not located in the custom position.
When a Character is loaded, the camera is automatically reset to become Custom. As a result, when you set the CameraType right at the start of a LocalScript, this is overwrited as soon as the character joins the game. One of the ways to solve this, aside from waiting before setting the CameraType, would be to use a GetPropertyChangedSignal to revert the camera back to Scriptable as soon as it changes.
local Cam = workspace.CurrentCamera Cam.CameraType = Enum.CameraType.Scriptable Cam:GetPropertyChangedSignal("CameraType"):Connect(function() Cam.CameraType = Enum.CameraType.Scriptable end)
And if you are looking to edit the CFrame of the camera, Scriptable is the CameraType you are looking for.