Disabling specific keys from being input?

hi all,
was just wondering if - similar to disabling all of a player’s controls - there’s an easy, cut and dry method of ignoring inputs from a specific key in UIS, thus making any subsequent calls (input.KeyCode == Enum.KeyCode.W) always return false (until reenabled)

I’m fairly certain there’s not, but I’m more than happy to be wrong; it would make my code a lot neater. thanks for the help!

You can bind a key with ContextActionService and have it do nothing, this will block the input from reaching other binds.

1 Like

looks to work, thanks for the suggestion!

You could just use a debounce variable.

local debounce = false

local function onInputBegan(key, processed)
    if processed then return end
    if key.KeyCode == Enum.KeyCode.W and (not debounce) then
        debounce = true
        task.wait(1)
        debounce = false
    end
end

userInputService.InputBegan:Connect(onInputBegan)

not the behavior I intended to create lol, but thank you.