Previously, you would disable the Control script as a hacky way to disable movement.
With the new PlayerModule comes improved functionality.
In order to disable controls, you would need to require the player module, get the controls, and run the Disable method. This can only be used locally
-- This require statement gathers the new player scripts.
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
-- In order to access controls, you must first get the controls
local Controls = PlayerModule:GetControls()
-- For Cameras, use PlayerModule:GetCameras()
--[==[ You have now obtained the new control methods! Yay! ]==]--
-- In order to enable controls, you need to use the reference Controls instance and call the Enable method within it.
Controls:Enable()
-- In order to disable controls, you need to use the reference Controls instance and call the Disable method within it
Controls:Disable()
I’d believe that more documentation over the new PlayerScripts will be created, but for now limited documentation exists, seen here
If you have any more questions or if I made an error, please reply to this message.
Ok I know I’m necroing this but I have something to add.
Controls:Disable() (or Controls:Enable(false)) only disable the currently active controller! This means if a player switches from keyboard to gamepad, or between any two distinct “controllers” in the player module, the new one will be enabled, i.e. the player will regain control of their character if they simple swap input method.
I’m not sure if there is an elegant way to get around this, but if you want to guarantee that a player can’t move it’s still probably best practice just to set WalkSpeed to 0.