Send keyboard and mouse input
inputSimulate real keyboard and mouse events in a running Roblox playtest to test key bindings, menu interactions, and text entry that movement controls cannot verify.
Instructions
Sends real keyboard and mouse input to a running playtest — the same events a person pressing the keys would produce.
This is how to test what character cannot reach. character drives the Humanoid directly, which answers 'can it get to the door'; this answers 'does pressing E open it', 'does the sprint key work', 'does the menu close on Escape' — anything bound to input rather than to movement. Use character for going places and this for controls.
Steps run in order, so a sequence is one call: tap E, wait, click at a point, type a name. hold is how long a key or button stays down, after is how long to wait before the next step — a jump held for a second is a different test from a tapped one.
REQUIRES A RUNNING PLAYTEST, and must be addressed to the playtest's studioId from list_studios, not the editor's.
A pointer is drawn on screen and travels to each target before the click, so the user can see what you are aiming at. Turn it off with cursor: false.
How it works, because it explains the one thing that will surprise you: input belongs to the data model that creates it, and the character is driven by the CLIENT. Sending from the playtest's server succeeds and moves nothing. So this parents a short script into the player's PlayerGui, which runs on their client, and that reports back when the input has actually been delivered. Nothing is reported as sent until the client confirms it. If confirmation never arrives you get an error, not a success — check where things really are with character op="state".
Mouse coordinates are viewport pixels from the top-left, so pair this with screenshot to see what is where before clicking it, and send what you read off the picture unchanged. The reply's landed shows the same click in the game's own coordinates, which sit a topbar lower — that difference is two ways of describing one point, not an error to correct for. Under an emulated device it is a real distortion instead, and the reply says so; there, re-read it after each click rather than reusing an earlier one.
Take the screenshot immediately before clicking. The reply is measured against the viewport as it is NOW, and a Studio window that changed size since the picture was taken moves everything in it — measured, a window that went from 435 to 952 pixels wide between a screenshot and a click, where the click reported success and hit nothing.
A text step types into the FOCUSED TextBox. Click the box in the same call, one step before the text, and the focus is taken for you; with no box to type into the step is reported as having done nothing rather than as delivered.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| steps | Yes | Input steps, delivered in order. | |
| cursor | No | Draw a pointer on screen that travels to each target before the click, with a ripple where it lands. On by default: synthetic input is otherwise invisible, so the user watching sees effects with no cause, and a click that misses looks identical to one that hit. Turn it off only when recording something where the pointer would be in the way. | |
| player | No | Which player, by name. Omit for the only one; needed in a multiplayer test. | |
| studioId | No | The PLAYTEST session's id — not the editor's. See list_studios. |