Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How Do IDisable WASD Movement?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
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
0
Thank You! :D superender11 -17 — 5y
Ad
Log in to vote
1
Answered by
valchip 789 Moderation Voter
5 years ago
Edited 5 years ago

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
0
Players can just exploit to get WalkSpeed and JumpPower. User#19524 175 — 5y
0
Just create an antiexploit script.. valchip 789 — 5y
0
Not easy. Exploiters can combat them. User#19524 175 — 5y
0
This is a *CLICK TO MOVE* Game im tryin to make here. superender11 -17 — 5y
Log in to vote
1
Answered by 5 years ago

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

Answer this question