So, I’m trying to make a main menu that shows what’s happening live on the background. The problem is, although the CameraSubject and the CameraType is correctly changed(in the properties), the camera subject is on a different part. Basically, on the camera properties, the camera subject is correctly changed but in its not
local credits = buttonframe.Credits
local creditframe = O.CreditsFrame
local blackout = O.Blackout
local var = 1
local db = false
local op = false
local player = game.Players.LocalPlayer
local camerapart = game.Workspace:WaitForChild("CameraPart")
local camera = game.Workspace.Camera
player.CameraMode = Enum.CameraMode.LockFirstPerson
camera.CameraSubject = game.Workspace.CameraPart
camera.CameraType = "Fixed"
the first thing you should do is set up the camera type, and you wouldnt use “Fixed”. Instead you’d use an enumerator… so for your case you’d do workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
local camerapart = game.Workspace:WaitForChild("CameraPart")
local camera = game.Workspace.Camera
player.CameraMode = Enum.CameraMode.LockFirstPerson
camera.CameraType = Enum.CameratType.Scriptable
camera.CFrame = cameraPart.CFrame
If you are just setting the camera’s position I think this should work. Just make sure the front of the camera part is facing where you want the camera to look.
Also, this wiki article has a good example showing a simple cutscene that could be of use. Also if you check the wiki article linked customer is the default camera behaviour.
Under the red error there is blue text that says stack begin and then goes down to stack end. I think its the lock first person line though and is uneeded when the camera is in the scriptable state.
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
local cameraPart = pathtocamerapart
task.wait() -- ignore for now
camera.CFrame = cameraPart.CFrame
camera.CameraSubject = cameraPart
I’m pretty sure that error is thrown when the camera type is set to scriptable… I had that issue before it’s buggy. Instead I use custom for the camera type, try the script I posted and let me know if it works.
The CameraType needs to be scriptable. Custom is the default behaviour for the camera and will just follow the player. Setting the camera type to scriptable means that you can alter the properties such as CFrame with a script.
Yeah I know but my workaround for this was controlling the behavior for the camera, and once this was done I set it back to fixed. Whenever I’d use scriptable I get the same error he does