Help accessing PlayerModule in a character script

Is this works?

local LocalPlayer = game:GetService("Players").LocalPlayer
local Cameras = require(LocalPlayer.PlayerScripts.PlayerModule):GetCameras()

Yeah someone else told me about that already but no not exactly. If you try it in studio you get an empty table when you print. Which shouldnt be the case it should have stuff in it.

Can you print LocalPlayer then?

If couldn’t print LocalPlayer(Other than unknown and Player named Player), it was the root of problem.

PS: Have you checked this?

When you require() the PlayerModule ModuleScript, it returns the result of the PlayerModule.new() function, or a new PlayerModule instance:
image

In the .new() function, the PlayerModule sets the properties .cameras and .controls to the CameraModule and ControlModule.
image

When you run the code with the colon and all, it runs this function, returning whatever is stored in the .cameras index:
image

If we look at the CameraModule ModuleScript to see what it actually returns, we can see that it returns an empty table if this “FFlagUserRemoveTheCameraApi” is evaluated as true.
image

In other words, maybe the problem is that this FFlagUserRemoveTheCameraApi thing is being evaluated as true for some reason. I haven’t really looked through the scripts though so I don’t exactly know how you could get the result you’re looking for, but you might be able to follow this variable and see what you need to change at some point along that path.

1 Like

ty ty that did it. Yeah idk what that is either so i just said YOLO and set
local cameraApi = cameraModuleObject
worked perfectly. Thanks

1 Like