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

How to lock a camera in place in roblox?

Hi there! So, I'm currently developing a horror game and I'm trying to make a cool menu loading screen. My plan is to have the "Play" button and have a spooky scene in the background. I've built my scenery and placed in my play button but I can't seem to lock the camera right. I want to lock player's camera in a certain place as soon as they joined.

Below is my script.

repeat wait() until workspace.CurrentCamera

local camera = workspace.CurrentCamera

camera.CameraType = Enum.CameraType.Scriptable camera.CFrame = (workspace.cameraLookAt.CFrame + Vector3.new(0, 0, 10))

If I've done anything wrong please correct me in the replies. Thank You!

2 comments

0

please put script lines

0

Make sure your script is a localscript, or else you cannot get currentcamera.

1 answer

So you want it to look at a certain part? If so... Here is your fixed script.

local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local focuspart = game.Workspace.FocusPart --- part you want the camera to focus on
repeat wait() 
local character = player.Character or player.CharacterAdded:Wait(1) 
until character 
cam.CameraType = Enum.CameraType.Fixed
cam.Focus = focuspart.CFrame

1 comment

0

Thank you very much! It works!

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