Input "Layers" or "Channels"

As a roblox developer, it is currently too hard to manage key input for large games with multiple menus.

I’m working on a game called Midnight Racing: Tokyo, in which I would like to add a tutorial. Right now, tutorials are made using screenshots and text boxes - a very efficient way, but a less effective learning tool. I can’t force the player to click the button they need to click to continue on with the tutorial, or make interactive scenes within the screenshots. A solution would be input layers.


Input layers would allow developers to direct player’s input to only fire bindings that are bound to the same input layer. For instance,

Ingame command: E to enter vehicle

local enterCar = function() end
local GoToNextMenuPage = function() end
Service:BindToKey(Enum.KeyCode.E, enterCar, "inGame")
Service:BindToKey(Enum.KeyCode.E, GoToNextMenuPage, "Menu")

Player enters menu
Input layer changed from “inGame” to “Menu”

Service.InputLayer = "Menu"

Now when the player presses E, they will no longer enter the car, but instead it will connect the menu callback bound to E (or do nothing at all.).

If a command needs to work across the menu and the game (for instance, the chat) then you could bind a keybind to two different layers. for instance:

local callback = function() sendchat() end

Service:BindToKey(Enum.KeyCode.Slash, callback) -- no third argument means the binding will connect regardless of layers.

It would be fantastic to also add in support for button clicks and mobile with a feature like this. I think that roblox input is sort of disbursed across different services (mouse, UIS, ContextAction, MouseButtonClick events, etc.) and it’s time to get an input service that can handle it all.

Thanks!

2 Likes