The simple way to do it, is to create a button in the UI and have both .Activated and BindAction associated with it to cover both keyboard and touch input:
local function buttonPressed()
print("Button was pressed")
end
-- Connect to capture both touch and mouse click on UI button
btnPressed.Activated:Connect(function()
buttonPressed()
end
-- Keybind event to Q
local btnValue = "Q"
ContextActionService:BindAction(btnValue , buttonPressed, true, Enum.KeyCode.Q)
The above rough code caters for both types of interface from users so allows a single common interface. I have been using variations of this to create custom backpacks in recent months with some success