Roblox keeps parenting camera to nil

I’m currently working on a custom camera system in Roblox.

Issue that arises however is that whenever more than 1 camera object is present in Workspace, Roblox parents all other cameras to nil.

This is severely annoying as I have to reparent them back every time and there’s no guarantee that a camera object will be present when another script would have to look for it.

Any potential solutions would be greatly appreciated, this seems like such a simple and trivial thing to solve however this seems like one of Roblox weird, hard-coded quirks that have no obvious work-around.

I must guarantee that a camera ALWAYS exists, I cannot have random, unwarranted nil-parenting happening in my projects.

I would recommend placing parts where you need other cameras to be and then doing the rest in a local script.

Here’s some code that may help you:

local cam = game.Workspace.CurrentCamera
local RandomCamera=game.Workspace:FindFirstChild("RandomCamera")--this is a part

cam.CameraType=Enum.CameraType.Scriptable
cam.CFrame=RandomCamera.CFrame

You can reset the players camera by doing this in a local script:

game.Workspace.CurrentCamera.CameraType=Enum.CameraType.Custom

I do know how to script cameras, I disabled Roblox player modules since I’m writing my own from scratch.

Cameras are already scriptable, the issue is that they keep getting parented to nil when switching to a different camera.

It’s as if Roblox doesn’t allow multiple camera objects to exist simultaneously.
Which is weird, reparenting them back to workspace DOES seem to make them re-appear, but only momentarily, if workspace.CurrentCamera is changed, cameras are reparented to nil.

It’s a ROBLOX limitation, you can’t have multiple cameras inside of the workspace. You have to use parts and set it to their CFrame instead.

Strangely enough cameras do not get reparented if placed inside a model or object, they just do if there is more than 1 camera in workspace (top hierarchy).

This is so weird because I can find nothing about it in the Roblox documentation.

Definitely some undocumented engine level behavior, I remember getting confused about this when I made my first main menu screens and character customization screens lol.

1 Like

The current solution for this problem just seems to be to simply not parent a camera to workspace but place it inside a model, part or any other object instead.

I’ll mark it as the solution for now.
It’s definitely undocumented engine behavior which is why I requested a change to the documentation.

I honestly wish this behavior was customizable as I find it quite inconvenient at least.