Hi! Today I will be sharing some knowledge I have found useful as a developer. I will teach you how to make a player not be able to move. So first, **Add a script into → StarterGui ← **
So first we must access the player. We do that by entering in this script local players = game:GetService("Players") local player = players.LocalPlayer
Then, we find the scripts inside the player by entering this: local playerscripts = player:WaitForChild("PlayerScripts")
Then, we will find the actual script itself by entering this: local PlayerModule = require(playerscripts:WaitForChild("PlayerModule"))
And now, we use this to get the controls of the player:
local Controls = PlayerModule:GetControls()
And now, you can enter this to disable the controls:
Controls:Disable()
And get the controls back: Controls:Enable()
So your whole script should look like this:
`` local players = game:GetService(“Players”)
local player = players.LocalPlayer
local playerscripts = player:WaitForChild(“PlayerScripts”)
local remote = game.ReplicatedStorage:WaitForChild(“Sup”)
local PlayerModule = require(playerscripts:WaitForChild(“PlayerModule”))
local Controls = PlayerModule:GetControls() ``
I hope this helped! -Xxoof_oofoofxX
(Please do not criticize me this is my first tutorial)
For cutscenes. When you don’t want the player to be able to control theirself, but the cutscene can. If they were anchored, then that’s not possible. Setting the WalkSpeed to zero also makes this not possible. It’s best to use the PlayerModule like in this tutorial.
Another example is a custom seating system, where someone has to click a key instead of jumping to exit a seat. The jump height could be set to zero or the controls can be disabled.
use humanoid walkspeed and humanoid jumppower, im unsure why there is this much unnecessary code, or if you want the player to never move in the game set the walkspeed in game settings to 0
Using this code disables/enables the use of the “WASD” keys, alongside the spacebar allowing players to not use the movement keys at all but still being able to move (if using humanoid:MoveTo, as an example), there’s also other uses for this which have been explained earlier in topic.