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

How would I go about making a script that locks a camera at 1 position?

Asked by 4 years ago

I'm trying to make a game that I can move the camera around without the player controlling it. I've found this in games like 'Steamed Hams' and lots of cut scenes in many games. Code I have so far:

game.Workspace.CurrentCamera.CameraSubject = game.Workspace.CameraPart1
wait(5)
game.Workspace.CurrentCamera.CameraSubject = game.Workspace.CameraPart2

I've been told to do this yet it did not work.

What am I doing wrong?

0
Is the code in a LocalScript? Make sure it is. Also, instead of using wait(), you may want to use the RenderStepped event of RunService when manipulating cameras. You can read about it here: https://developer.roblox.com/en-us/api-reference/event/RunService/RenderStepped Loughdough 291 — 4y
0
Ok, I'll look into it! sean_thecoolman 189 — 4y
0
Would I have to make the camera 'Scriptable'? sean_thecoolman 189 — 4y
0
Yes :) Sorry, almost forgot to mention that. Loughdough 291 — 4y
0
Alright, thanks! sean_thecoolman 189 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You have to set the camera's type to "scriptable" before changing its CFrame, focus, etc.

game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable

-- then enter your script

Hope this helped!

Ad

Answer this question