Any way to detect if a keyboard is connected?

Pretty simple question. I looked over this post on the DevHub, and I couldn’t find anything mentioning the detection of a keyboard device.

I want to let the player use the Tab key to hide more and more of a player list, and as not everyone uses a keyboard, I was going to make a simplified version of the list for mobile devices or ones without keyboards.

You can use UserInputService to check if a keyboard, mouse, gamepad, or touch is enabled.

Sample code:

local UserInputService = game:GetService("UserInputService")
local hasKeyboard = UserInputService.KeyboardEnabled
print(hasKeyboard)
2 Likes