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

Why is the CameraSubject not attaching to the brick?

Everything works but when the BlackOut Frame goes away, the camera is just stuck wherever it was before, not the brick.

local cam = workspace.CurrentCamera
local cartCameraBlock = workspace.Configuration.cartSelectorCam

wait(5)
for i = 1,0,-.05 do
	script.Parent.blackoutFrame.BackgroundTransparency = i
	wait()
end
repeat
	wait()
	cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
cam.CameraSubject = cartCameraBlock
for i = 0,1,.05 do
	script.Parent.blackoutFrame.BackgroundTransparency = i
	wait()
end

1 answer

✓ Accepted answer

Whenever you set the CameraType to Scriptable, and then change the CameraSubject to anything but a player's Character, the camera will only be moved manually by changing it's CFrame, or by changing it's type again and setting the CameraSubject.

So with that said, a Scriptable camera will NOT focus on the new CameraSubject automatically. If you want this effect while in this mode, you must do the math and manually CFrame it to be so.

Otherwise, I recommend Enum.CameraType.Watch, which does automatically focus on the set CameraSubject.

cam.CameraType = Enum.CameraType.Watch
cam.CameraSubject = cartCameraBlock

As a side note, there is no need for the following snippet to be in your code:

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

I am assuming you have that just because you didn't know how the Scriptable type worked, and wanted to make sure it was set, however it is ultimately not useful to you.

1 comment

0

That worked! Thank you, one more question if you don't mind answering, how do I angle the camera? I tried multiplying it by CFrame.Angles and got an error.

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