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

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

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?

5 comments

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

0

Ok, I'll look into it!

0

Would I have to make the camera 'Scriptable'?

0

Yes :) Sorry, almost forgot to mention that.

0

Alright, thanks!

1 answer

✓ Accepted answer

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!

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