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

How do I make typing not trigger hotkeys that I made?

Asked by 6 years ago
Edited 6 years ago

I'm using stuff like KeyCode.F for functions, but if I were to press F while typing it does it.

One of the hotkeys.

01dodging = false
02uis.InputBegan:connect(function(input)--Dodge
03    if input.KeyCode == Enum.KeyCode.E then
04      if dodging == false then
05           if game.Players.LocalPlayer.Character.Humanoid.Mana.Value < 24 then return end
06                   if game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value > 24 then
07           game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value - 25 end
08          gg = Instance.new("BodyForce")
09          gg.Parent = Player.Character.Torso
10          gg.Force = Player.Character.Torso.CFrame.lookVector*-5000
11          Player.Character.Humanoid.Jump = true
12          dodging = true
13          wait(0.3)
14          gg:Destroy()
15          wait (0.4)
16          dodging = false
17        end
18    end
19end)

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago
01dodging = false
02uis.InputBegan:connect(function(input, gameProcessedEvent)--Dodge
03    if input.KeyCode == Enum.KeyCode.E and gameProcessedEvent == false then
04      if dodging == false then
05           if game.Players.LocalPlayer.Character.Humanoid.Mana.Value < 24 then return end
06                   if game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value > 24 then
07           game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Mana.Value - 25 end
08          gg = Instance.new("BodyForce")
09          gg.Parent = Player.Character.Torso
10          gg.Force = Player.Character.Torso.CFrame.lookVector*-5000
11          Player.Character.Humanoid.Jump = true
12          dodging = true
13          wait(0.3)
14          gg:Destroy()
15          wait (0.4)
16          dodging = false
17        end
18    end
19end)

When a key is pressed while typing, or pressing a button or something like that then gameProcessedEvent will be true, if not then it's false

(I only edited lines 2 and 3, added ", gameProcessedEvent" on line 2, and "and gameProcessedEvent == false" on the 3rd line.

0
How do I use that to fix the problem? Edbotikx 99 — 6y
0
Can you edit your question and actually include some code so I can see how to fix your problem User#1007 6 — 6y
0
Done Edbotikx 99 — 6y
0
Updated answer User#1007 6 — 6y
Ad

Answer this question