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

How to turn off input keys for some time?

Asked by 4 years ago

For example player touched a part, which cause him activate GUI. While GUI is active, WASD and Space must not work. So, im not sure, what function from UserInputService i supposed to use for that.

0
u can anchored the humanoidrootpart to make sure they cant move IcyMizu 122 — 4y
0
Seems like it's an artisanal way to do it. At least, there will be animations of moving. Any other way? Gulgazar 65 — 4y
0
you can set the humanoids walk speed and jump power to 0 questionthonk 36 — 4y

2 answers

Log in to vote
0
Answered by
MemezyDev 172
4 years ago

Just change the players jump power and the walkspeed

1local player = game.Player.LocalPlayer
2local humanoid = player:WaitForChild('Character').Humanoid
3 
4humanoid.WalkSpeed = 0
5humanoid.JumpPower = 0

and the default walkspeed is 16 and the default jump power is 50 just check if the frame is visible to disable walking

Ad
Log in to vote
0
Answered by 4 years ago

If someone has the same question, there is a way to disable controls:

01--//  Require Controls in LocalScript
02 
03local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
04 
05--//  Disabling Controls
06 
07controls:Disable()
08 
09--//  Enabling Controls
10 
11controls:Enable()

Answer this question