PlayerModule:GetCameras() returns empty table

Reproduction Steps
Run the following code in a localscript:

local cameras = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetCameras()
print(cameras)

You’ll see it prints

{}

Expected Behavior
It should return something that can be used to modify the camera

Actual Behavior
An empty table is returned with no way to access the cameras

Workaround
We fork the PlayerScripts to fix several bugs that Roblox has not, such as this one

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2021-08-07 00:08:00 (-07:00)
Date Last Experienced: 2021-08-07 00:08:00 (-07:00)

3 Likes

I hope I’m not providing a useless remark here, but this doesn’t seem like a bug but rather something weird Roblox did. There’s an FFlag, UserRemoveTheCameraApi, which makes CameraModule return a blank table when it’s enabled. If the FFlag is disabled, then the created Camera object is returned.

Cannot find an announcement explaining why the Camera API is removed. For anyone else wondering how they can fix this issue, scroll to the very bottom of CameraModule and replace the FFlag if statement to just return cameraModuleObject directly.

How it looks:

if FFlagUserRemoveTheCameraApi then
	return cameraApi
else
	return cameraModuleObject
end

Change it to this:

return cameraModuleObject

Requires PlayerModule to be forked.

1 Like

I couldn’t find any announcement either which is why I filed it as a bug. That’s really weird how they’ve intentionally disabled it when you can fork it to fix the behavior. More reasons for community-hosted corescripts >.<

2 Likes

Yeah, here’s the old fight over it:

Was sprung on us and broke a lot of stuff including the ability to properly manage
mouselock state.

The oddest thing about it was it was as if the right hand didn’t know what the left hand was doing–
As the new PlayerScripts structure was still relatively new and a big point of its being done was to
give access to things that would obviate the need to fork the scripts, but when they pulled the Camera
API, they forced many to fork the scripts! Crazy.

2 Likes