UserInputService
Methods
IsKeyDown
Returns whether a certain is being held down.
UserInputService:IsKeyDown(KeyCode: Enum.KeyCode): BooleanParameters
KeyCode: Enum.KeyCodeThe Enum.KeyCode of the keyReturns
BooleanWhether the specified key is being held down or not.This method returns true if they are holding down the specified key, otherwise it returns false.
Examples
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function() if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then print("Left Shift") endend)Events
InputBegan
Fires whenever the Player interacts with an input device.
UserInputService.InputBegan(Input: InpitObject, GameProcessedEvent: Boolean)Parameters
Input: Input ObjectAn Input object which contains information about the users input.GameProcessedEvent: BooleanWhether the Engine observed an action and acted on it. If a button was touched or clicked from this input, GameProcessedEvent will be true.Returns
Examples
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(Input, GameProccessedEvent) if GameProccessedEvent then print("Game Proccessed Event") end
if Input.KeyCode == Enum.KeyCode.R then print("R") endend)