|
| 03 Apr 2015 09:44 PM |
| Is it possible to create a function that can fire a line of code that would simulate a key-press on the keyboard? I'm optimising my game for Xbox controller support and I want to make it possible for players to cycle through numbers 0-9 using the left and right d-pad, then press Y to fire the selected number as a keyboard input to be able to select different items in their inventory. I've searched the wiki and can't seem to stumble across anything that relates to simulating a key-press with a function. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2015 09:50 PM |
| The best way is to make your own inventory and control system. You can't simulate a keypress in Roblox. |
|
|
| Report Abuse |
|
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 30 Nov 2015 09:29 PM |
| bumping this thread back to life, because im trying to make a button for ios that on touch will emulate the user pressing the "r" key. I couldn't find any other posts on this or anything about this on the wiki so if anyone has a script or a wiki links about this it would help alot! |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2015 09:31 PM |
| I don't think it's possible to emulate input in the game. Sorry :( |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2015 10:10 PM |
| You actually can emulate input and other events, but its completely restricted rn |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2015 10:13 PM |
The easiest way to do this is writing your code to run external handler calls (functions run without triggering the event they're connected to). For example:
function Touched(hit) print(hit.Name) end script.Parent.Touched:connect(Touched)
Touched(workspace) --> Workspace
In this case, the Touched function is called separately from the event, and the code to handle said event runs anyway because we forcefully called the function. |
|
|
| Report Abuse |
|
|