Having trouble trying to access the camera module

I’m having trouble trying to access the camera module

  1. What do you want to achieve? Keep it simple and clear!
    I want to get the camera module
  2. What is the issue? Include screenshots / videos if possible!
    Cameras in PlayerModule is {}
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local Cameras = PlayerModule:GetCameras()
print(Cameras)
print(PlayerModule)

image

  1. What solutions have you tried so far?
    I tried to import the same module from another game.
  • Did you look for solutions on the Developer Hub?
    Yes, but I didn’t found nothing.
1 Like

Why you need to acess to the module?

local aCC = Cameras.activeCameraController
aCC:SetIsMouseLocked(true) <--

I want to use that function

What does :GetCameras() do
and what output those prints give

nvm about that but i found same kind of code but with :SetIsMouseLocked(false) so set to false. Idk what it does but maybe thats what u wanted to do?

I think he try to do some kind of Force Shift Lock that what they called.

Yes, it’s kinda of rare because it works on other games I have but in this game it return {}.

Ok after some searching in CameraModule and Roblox Devforum I found where is the problem, recently Roblox add some kind of filter to the CameraModule called Camera API or something like that, if you look at the end of the CameraModule script you will find

local cameraModuleObject = CameraModule.new()
local cameraApi = {}

if FFlagUserRemoveTheCameraApi then
	return cameraApi
else
	return cameraModuleObject
end

The reason of this to stop users from changing the module externaly, so if FFlagUserRemoveTheCameraApi is true the CameraModule will return an empty table which is the cameraApi.
The FFlagUserRemoveTheCameraApi is defined by
UserSettings():IsFeatureEnabled("UserRemoveTheCameraApi")

So to fix all of this you should change the end of the camera module to this:

return cameraModuleObject

and copy the hole PlayerModule in your StarterPlayerScripts, I already edit the module, so if you dont know how to do that just download this and paste it in your StarterPlayerScripts.
PlayerModule.rbxm (122.0 KB)

2 Likes