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

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

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

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