Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to bind a mobile button to a key on a keyboard?

Hi, so I have special sword moves that require you to press Z on the keyboard to use. I want to make a mobile button that replicates what happens when you press z on the keyboard. How would I do this?

1 answer

✓ Accepted answer

You could create a button on the GUI and have the text similar to something that resembles the move you are trying to do and then set the visibility of the button to false and then check if the player is on mobile by doing the following:

local UserInputService = game:GetService("UserInputService")
 
if (UserInputService.KeyboardEnabled) then
	button path.Visible = false
else
	button path.Visible = true
end

that would go in a local script.

Please contact me if you have any errors

This discussion is preserved as it was. New answers, comments, and votes are closed.