I want to make a mobile button that presses a computer key.
I’ve tried many solutions from people with the same problems as me and also tried a the mobile button page. I only need this because I want to add mobile support to a game i’m creating,
Here is some code from the creating mobile page that I tried but didn’t work. (it creates the button but doesn’t press a key down when pressed)
1. local ContextActionService = game:GetService("ContextActionService")
* local function handleAction(actionName, inputState, inputObject)
2. if inputState == Enum.UserInputState.Begin then
3. print(actionName, inputObject)
4. end
5. end
* -- Bind action to function
6. ContextActionService:BindAction("Interact", handleAction, true, Enum.KeyCode.T, Enum.KeyCode.ButtonR1)