Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix a players camera in one set spot?

I'm trying to make a Five Nights at Freddy's type game, with the player's camera fixed in one spot right in front of the desk, but I can't figure out how.

Could someone help me with exactly how to do it?

1 answer

You'll need to change the camera's type to scriptable and then set the coordinates and rotation you want the camera to face in.

-- In a local script
local camera = game.Workspace.CurrentCamera

camera.Type = Enum.CameraType.Scriptable
camera.CoordinateFrame = CFame.new(x, z, y) * CFrame.new(rx, ry, rz) -- Set the CFrame and Rotation of Camera manually

If you didn't want to set the CFrame manually, you could instead set a block's CFrame and lookVector to the position you want the camera to go to and then make the Camera's CFrame equal to the Block's CFrame.

2 comments

0

Just a question: Where would I put this local script? Just in the plain Workspace?

0

Local scripts must be run in a local environment: such as the Player's Backpack or PlayerGui

This discussion is preserved as it was. New answers, comments, and votes are closed.