Making a main menu that has camera manipulation in it

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

But how do I make a player’s camera be fixed on a specific part?

you’d first set the workspace current camera type to custom, and after that you’d change the camera subject to a part

camera.CameraType = Enum.CameraType.Custom

camera.CameraSubject = camerapart

camera.CameraType = Enum.CameraType.Fixed

it still doesn’t work, is this how I do it?

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.

for your camera part use workspace.CurrentCamera

It doesn’t work, but this came out on the output

ActivateCameraController did not select a module. - Client - CameraModule:335

send the script and we’ll look over it

Sorry, use the workspace.CurrentCamera for the camera variable as @dejectedDx suggested.

Still doesn’t work even though I changed it to CurrentCamera.

Script:

local camera = game.Workspace.CurrentCamera

player.CameraMode = Enum.CameraMode.LockFirstPerson

camera.CameraType = Enum.CameraType.Scriptable

camera.CFrame = camerapart.CFrame

@dejectedDx

can you paste the stack error? I’m fairly sure it’s the LockFirstPerson line as I had a similar problem the other day.

I’m not sure what a stack error ism but it says this

ActivateCameraController did not select a module.

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
1 Like

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

It works now, thanks a lot. Appreciate it

great have fun and good luck on your project

1 Like