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

local player = game.Player.LocalPlayer
local humanoid = player:WaitForChild('Character').Humanoid

humanoid.WalkSpeed = 0
humanoid.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:

--//  Require Controls in LocalScript

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

--//  Disabling Controls

controls:Disable()

--//  Enabling Controls

controls:Enable()


Answer this question