PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

KeyboardEnabled

UserInputService

bool

The KeyboardEnabled property becomes true if the device being used by a user has a keyboard available. This boolean property is true when the user’s device has an available keyboard, and false when the user’s device does not have an available keyboard.

It can be used to determine whether the user has an available keyboard - which can be important if you want to check if you can use UserInputService functions such as UserInputService/IsKeyDown, UserInputService/GetKeysPressed, etc. to check for keyboard input. (see the UserInputService class page for a full list).

Since UserInputService only runs client-side, this property will only work when used in a LocalScript.


Code Samples


UserInputService.KeyboardEnabled

This example prints “The user’s device has an available keyboard!” if KeyboardEnabled is true and “The user’s device does not have an available keyboard!” if KeyboardEnabled is false.

local UserInputService = game:GetService("UserInputService")

if (UserInputService.KeyboardEnabled) then
	print("The user's device has an available keyboard!")
else
	print("The user's device does not have an available keyboard!")
end