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

How Do IDisable WASD Movement?

I'm basically making a Click-To-Move style game, and I don't want the player to use WASD (or be able to jump) And all of the solutions I've found just say to put:

for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
    controller:Destroy()
end

Into a localscript.

But all I get when I try this is:

Workspace.Player1.LocalScript:1: attempt to index a nil value

Hell Happened?

3 answers

✓ Accepted answer
game:GetService("ContextActionService"):UnbindAllActions()

local plr = game:GetService("Players").LocalPlayer 
local playerScripts = plr:WaitForChild"PlayerScripts"

for _, v in pairs(playerScripts:GetChildren())) do 
    if v.Name == "ControlScript" then 
        v:Destroy()
    end
end

1 comment

0

Thank You! :D

Why would you want to disable WASD, or the controller? You could just do this:

local player = game.Players.LocalPlayer

player.Character.Humanoid.JumpPower = 0
player.Character.Humanoid.WalkSpeed = 0

Local script, StarterGui.

You can even set the player's JumpPower and WalkSpeed back to normal, just do this:

local player = game.Players.LocalPlayer

player.Character.Humanoid.JumpPower = 50
player.Character.Humanoid.WalkSpeed = 16

4 comments

0

Players can just exploit to get WalkSpeed and JumpPower.

0

Just create an antiexploit script..

0

Not easy. Exploiters can combat them.

0

This is a CLICK TO MOVE Game im tryin to make here.

Easy. Just insert a blank LocalScript named ControlScript into the StarterPlayerScripts folder under StarterPlayer.

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