Still have questions? Join our Discord server and get real time help.
0

# How to fix the camera where I want it to look?

xPolarium 1337
4 years ago

Basically i'm trying to make a main menu where the it starts the player off in said main menu. I want the camera to focus on a structure I made and not allow the player to move the camera, but only to click on the Menu GUIs to "Play" the game.

Using the wiki on Camera Manipulation I put together the two example scripts it gave using PlayerAdded. This is what I currently have on a local script that is put into the Player's character:

local cam = workspace.CurrentCamera
local LobbyCam = workspace.Lobby.LobbyCam
wait()

cam.CameraType = "Fixed"
cam.CameraSubject = LobbyCam



What's going on is when I press Play to test, the camera stays in the previous position of where I had it in Edit mode instead of where I want it to go.

0
Is it a local script? LordDragonZord 3291 — 4y
0
Yes, I said I put it in a local script. xPolarium 1337 — 4y
0
try it in a server-side script. LordDragonZord 3291 — 4y
0
#LordDragonZord, you can only access the CurrentCamera client sided. Goulstem 7980 — 4y
0
Thanks @ MastaJames xPolarium 1337 — 4y

0
BlackJPI 2620
4 years ago

Your problem has to do with the CameraType you set. A fixed CameraType does not watch, follow, or rotate with subject (here is a full list of the enums). What you want is a scriptable CameraType, as it allows you to set the CFrame of the camera and the player has no control over it.

Here is an example where you have two parts, one where you want the camera to be located and another that you want it to look at:

local camera = game.Workspace.CurrentCamera

local cameraLocation = game.Workspace.Part1.Position
local cameraTarget = game.Workspace.Part2.Position

camera.CameraType = Enum.CameraType.Scriptable
camera.CoordinateFrame = CFrame.new(cameraLocation, cameraTarget)