Accessing the PlayerModule objects

At the top of the PlayerModule script (found in PlayerScripts during runtime) is says:

provides getters for developers to access methods on these singletons without
having to modify Roblox-supplied scripts.

However there is no obvious way to access the objects it creates to be able to fire the methods within the script. If anyone knows how to access these objects that would be great.

1 Like

I haven’t used those scripts before, but I’m assuming that it means you can use require() on them.

It is not the requiring that is the issue, it is accessing the objects that it has created, when they are created they are returned however I can not find which script is calling the constructor.

I’m not really sure what the issue is and what you’re trying to access.

I am trying to access the objects created by this constructor:

function PlayerModule.new()
	local self = setmetatable({},PlayerModule)
	self.cameras = require(script:WaitForChild("CameraModule"))
	self.controls = require(script:WaitForChild("ControlModule"))
	return self
end

To access its methods.

Yes, these are returned by the module script, or maybe I don’t get the issue.

return PlayerModule.new()

So I think you should be able to do

stuff = require(game.Players.imalex4.PlayerScripts.PlayerModule)

This returned a table when I tried it, so I assume you can use that. Otherwise, if this isn’t what you’re looking for, I suppose I don’t have the help that you need.

Just requiring the script would not allow me to access the objects unless I modify the script which I would prefer not to have to do.

All of these have their own getter methods, (e.g. PlayerModule:GetControls())

local PlayerModule = require(game:GetService("Players").LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"))
local controls = PlayerModule:GetControls()