Lets make it so a player can't move!

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 ← **
Screenshot 2023-10-22 125009

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)

13 Likes

or humanoid.WalkSpeed = 0 could also work…

4 Likes

This makes it so they cant jump either.

3 Likes

humanoid.JumpPower/JumpHeight = 0

3 Likes

Would this work if the script was server sided?

2 Likes

I think PlayerModule is only local

1 Like

Did you know that criticism is important for skill improvements?


It’s better to anchor the player’s HumanoidRootPart

9 Likes

No it is not better to anchor the HumanoidRootPart. There are various times when the player can not be anchored but shouldn’t be controlled either.

9 Likes

If there are various times, then give me at list of these “various times”

1 Like

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.

6 Likes

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.

2 Likes

Why Not In ReplicatedFirst? It would work the same

1 Like

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.

I have a question
What is this used for?

game:GetService("ContextActionService"):UnbindAllActions()

ContextActionService | Documentation - Roblox Creator Hub.

anchoring the humanoidrootpart is not viable because it disables de death and other important functions