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

How to turn off input keys for some time?

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.

3 comments

0

u can anchored the humanoidrootpart to make sure they cant move

0

Seems like it's an artisanal way to do it. At least, there will be animations of moving. Any other way?

0

you can set the humanoids walk speed and jump power to 0

2 answers

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

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()


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