Help on Camera Lock

Hello! I am trying to make it so the camera will always follow the CameraSubjects, no matter what, it will follow orientation, position etc.

Here’s some videos of my game. At first the CaneraType is Scriptable. Meaning it will only stay where the CameraSubject is meaning, if the CameraSubject moves, the camera won’t move either, now when I turn on the security cameras, the CameraType is Attach, I used Attach so it follows the rotation but. There’s a problem, the player can freely look up and down, the only thing the camera will follow when on Attach is the rotation.

In the first one, I click something wich is supposed to move the CameraSubject, but the CameraType is Scriptable.

Now when I use the security cameras (The CameraType will now be Attach)

As you can see, the player can look up and down, and for one Camera I made it non-transparent to show it wasn’t following everything.

Now, the first button I click to turn the CameraSubject, but now the CameraType is Attach

I’ve been looking for solutions everywhere but don’t find any answers.

How could I make it so it’s scriptable and always follows the CameraSubject and follow every orientation.

Please help me.

1 Like

The first Camera Script for the CameraType.Scriptable

Local Camera = workspace.CurrentCamera

repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = workspace.CameraPart.CFrame

Hi, try this:

local Run = game:GetService("RunService")
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Run:BindToRenderStep("CameraSubject", Enum.RenderPriority.Camera.Value, function()
	if Camera.CameraSubject and Camera.CameraSubject:IsA("BasePart") then
		Camera.CFrame = Camera.CameraSubject.CFrame
	end
end)

This will follow whatever the Camera’s CameraSubject is. To disable it you can call:

Run:UnbindFromRenderStep("CameraSubject")
2 Likes

Thank you! I’ll try it! :heart:

It worked! Thank You So much! I really appreciate it!!