Navigating a GUI with Keyboard Keys Only

Hello users, today I would like to know how it is done so that I select “text buttons” only by keyboard keys, an example of what I am talking about.

Any way to learn how to do it?

You can make a table that holds all the buttons you want to be able to filter through in one area. For example, this is for a main menu:

local UIS = game:GetService("UserInputService")
local buttons = {GUI.PlayButton, GUI.OptionsButton, GUI.QuitButton} -- the aforementioned table 

local selected_button = buttons[1]

local function selectButton(button)
    selected_button = button
    -- apply visual effects to show they have `button` selected

UIS.InputBegan:Connect(input, gameProcessed)
    if input.KeyCode == Enum.KeyCode.C then -- move up
        selectButton(buttons[table.find(buttons, selected_button) + 1])
    elseif input.KeyCode == Enum.KeyCode.X then -- move down
        selectButton(buttons[table.find(buttons, selected_button) - 1])

You will need to make your own checks to make sure you don’t accidentally try to index buttons[0] or some other value that doesn’t exist. Hope this helps


Yes, that’s what I was looking for, thanks.