local key1Pressed = false
local key2Pressed = false
local UIS = game:GetService("UserInputService")
UIS.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.X then
key1Pressed = true
elseif input.KeyCode == Enum.KeyCode.W then
if key1Pressed then
key2Pressed = true
end
end
if key1Pressed and key2Pressed then
-- do stuff here
end
end)
local UIS = game:GetService("UserInputService")
local KeysPressed = {}
UIS.InputBegan:Connect(function(Input, Processed)
if (Input.UserInputType == Enum.UserInputType.Keyboard) and (not Processed) then
KeysPressed[Input.KeyCode] = true
if (KeysPressed[Enum.KeyCode.X] == true) and (KeysPressed[Enum.KeyCode.W] == true) then
print("yay")
end
end
end)
UIS.InputEnded:Connect(function(Input)
if (Input.UserInputType == Enum.UserInputType.Keyboard) then
KeysPressed[Input.KeyCode] = false
end
end)
elseif keyCode == Enum.KeyCode.X then -- I set the value here
print(keyCode)
pressingX = true
elseif keyCode == Enum.KeyCode.W and pressingX then -- this is what I need
print(keyCode)
print('UP ATTACK YAS')
end