Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I Disable Player Movement?

I want to make a script that will disable the player's ability to move their character, but still allow other scripts to move the character. I tried setting the character's walkspeed to 0, but then I couldn't move it with my own scripts. I was wondering if there's some sort of function I could use to basically disable WASD. Thank you for reading!

2 answers

✓ Accepted answer

Here you go:

This Is From A Local Script Inside Of StarterPlayerScripts

local MC = require(game:GetService("Players").LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule"):WaitForChild("ControlModule"))
MC:Disable()

2 comments

0

lol

0

Oh no I don't know which one to accept :(

Best way to go about it is disable the core controls script.

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

3 comments

0

If I then used that script and said controls:Enable() will it go back to normal?

0

Aye. It should.

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.