In this script I am trying to detect if the player is hitting “q” or “e” on their keyboard, and if they are hitting both. The issue i’ve been having is that when you go to check if they have both keys down, a key always shows up with it. Example of this being: When you click q, q appears if you click e e appears, but if you hold q and click e, the e prints with the other full q + e statement, I have tried moving the logic around and adding if not statements but they broke the script and I am at a loss.
screenshot example (Sorry for my bad writing, I use mouse)
Photo of the error, with explanation
Script:
local UIS = game:GetService("UserInputService")
local character = script.Parent
Keybind1 = Enum.KeyCode.Q
Keybind2 = Enum.KeyCode.E
UIS.InputBegan:Connect(function(input,gameprocessed)
if input.KeyCode == Keybind1 then
print("q... ")
end
if input.KeyCode == Keybind2 then
print("e...")
end
if UIS:IsKeyDown(Enum.KeyCode.Q) and UIS:IsKeyDown(Enum.KeyCode.E) then
print("Q and E are pressed down!")
end
end)
Any help is appreciated, this is in starterplayerscripts as well.