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

How do I combine keys so it can make a combo?

Asked by
p0vd 207 Moderation Voter
4 years ago
Edited 4 years ago

I was wondering how if the client presses F + E at the same time, it would register as one key and not a separate key. For example, if Player1 presses F + E he would do a combo which plays a punch animation. If Player2 presses F and E but he presses E with a delay, it registers it as a separate key and not a combo. Here is my attempt:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
    local F = Enum.KeyCode.F
    local E = Enum.KeyCode.E
    if input.KeyCode == Enum.KeyCode(F + E) then
        print("player pressed F and E at the same time.")
    end
end)

1 answer

Log in to vote
0
Answered by
p0vd 207 Moderation Voter
4 years ago

Nvm guys, I figured it out.

Ad

Answer this question