-- Certain Key
UserInputService = game:GetService('UserInputService')
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.E then --waits until E is pressed
print("E has been pressed")
end
end)
-- Any Key
UserInputService = game:GetService('UserInputService')
UserInputService.InputBegan:Connect(function(input, gameProcessed)
print(input.UserInputType) -- Detects if any key is pressed
end)
-- Print certain and any key
UserInputService = game:GetService('UserInputService')
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.E then
print("E has been pressed") -- waits until key is pressed to print
end
print(input.UserInputType) --prints any key
end)
Editor is loading...