Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to lock a camera in place in roblox?

Asked by
4o4g 2
4 years ago

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!

0
please put script lines Cynical_Innovation 595 — 4y
0
Make sure your script is a localscript, or else you cannot get currentcamera. proqrammed 285 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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
0
Thank you very much! It works! 4o4g 2 — 4y
Ad

Answer this question