PlayerModule:GetControls() doesn't always get controls

Why does this code only work sometimes?

local Controls = PlayerModule:GetControls()

sometimes it prints this, with the activeControlModule not empty
image

but somtimes it prints this with the activeControlModule empty
image

and its all completely random i dont understand it.

What exactly are you trying to do? What is PlayerModule:GetControls?

Could you post the relevant snippets of code?

Im just trying to have full control of the player so i can customize movemnt controsl etc, heres a snippet tho

local pMod = game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")
local PlayerModule = require(pMod)

local Controls = PlayerModule:GetControls()

Controls.controlsEnabled = false

This code is very random for when it decideds to disable controls because of the finicky GetControls method

I’m not sure what you’retrying to do particularly, I usually just make my own ControlScript and whatever you put in should override all default Roblox controls.

You can swap them on the fly at any time I believe.

Could you show me what you did?

Just put a localscript into StarterPlayerScripts and assign your controls in there, like this


It has to be called “ControlScript”
I also made my own PlayerModule for this game, which is why it’s already there in my screenshot.

but having to do that, for each console, (and movile devices), and creating ur own playermodule, while the given playermodule already does everything 10x better, with all the implmentations, having to create my own would take increasingly more time then figuring out a way to access it

You don’t have to make your own PlayerModule.

I did in this particular case, but you can use the default as long as you know how to assign the same controls across multiple input types in the same line. You do that through ContextActionService, like I showed.

All my module did was set the walkspeed and direction to be used when setting up controls in ContextActionService lol.

Hm dont really get it but still seems like too much work, i figured out a very scuffed way to do it but as they say, if it works it works :D.