ScriptEvent

Methods
11
Fields
10

Getting one

client:createScriptEventBuilder(…):build()

Methods

MethodReturnsDescription
getSource()Widget?The widget the WIDGET_ID and WIDGET_INDEX sentinels name.
getTarget()Widget?The drag-complete target, nil when there is none.
getArguments(){number | string}The arguments: index 1 is the script id, then the script's arguments as the event holds them (sentinels not replaced). A copy: a write to i…
setArgument(number, any)()Sets argument index (1-based as the Luau array getArguments() hands out: 1 is the script id, 2 the script's first argument) to value.…
getOp()numberThe menu op.
getOpbase()stringThe op base (the menu target text).
getMouseX()numberThe mouse x, relative to the source's parent.
getMouseY()numberThe mouse y, relative to the source's parent.
getTypedKeyCode()numberThe typed key's Jagex key code.
getTypedKeyChar()numberThe typed character.
run()()Runs the script the event names, on the client thread, now (not while a script runs: it is not reentrant). A listener token first runs that…

Fields

FieldTypeDescription
MOUSE_XnumberThe MOUSE_X sentinel: an int argument replaced by the event's mouse x.
MOUSE_YnumberThe MOUSE_Y sentinel.
WIDGET_IDnumberThe WIDGET_ID sentinel: replaced by the source's id.
WIDGET_INDEXnumberThe WIDGET_INDEX sentinel: replaced by the source's index.
WIDGET_TARGET_IDnumberThe WIDGET_TARGET_ID sentinel.
WIDGET_TARGET_INDEXnumberThe WIDGET_TARGET_INDEX sentinel.
KEY_CODEnumberThe KEY_CODE sentinel.
KEY_CHARnumberThe KEY_CHAR sentinel.
NAMEstringThe NAME sentinel: a string argument replaced by the op base.

Returned by

MethodReturnsDescription
ScriptEventBuilder.buildScriptEventThe event to run().
ScriptPreFired.getScriptEventScriptEvent?What started the root script (its arguments, source widget, op, ...): nil unless this is a root script a ScriptEvent started. Valid whi…

Method details

getArguments

getArguments: (ScriptEvent) -> {number | string}

The arguments: index 1 is the script id, then the script's arguments as the event holds them (sentinels not replaced). A copy: a write to it changes nothing (see setArgument).

setArgument

setArgument: (ScriptEvent, number, any) -> ()

Sets argument index (1-based as the Luau array getArguments() hands out: 1 is the script id, 2 the script's first argument) to value. In a ScriptPreFired handler it reaches the script when the delivery ends; an int stays an int and a string a string.

run

run: (ScriptEvent) -> ()

Runs the script the event names, on the client thread, now (not while a script runs: it is not reentrant). A listener token first runs that callback.