Skip to content

LocalDispatch

Internal

Not re-exported through require(Operator). This is not part of the public API and may move in a minor release. It is documented because understanding it matters when you are debugging, not because you should construct one. The internal path is ServerStorage.Operator.Client.LocalDispatch.

Runs a client command on the client. Binds and transforms arguments locally, builds a ClientContext, calls the handler, and returns a result shaped like the server's.

Api.run routes here automatically when a command is client-run. You would only call it directly from a custom interface that bypasses Api.run.

Functions

LocalDispatch.run

luau
LocalDispatch.run(command: Command, parsed: ParseResult, text: string): (Result, any?)

The second return is the raw error when the handler raised, for logging. It is never shown to the player. The result carries a generic message instead.

Types

Result

luau
type Result = {
	ok: boolean,
	status: string,
	message: string?,
	replies: { string },
	args: { [string]: string },
}

args holds the resolved arguments stringified, for the audit notification. Statuses match Dispatcher.Status.

StatusWhen
Okthe handler ran and reported no error
Invalidbinding or a transform failed, or the module was not delivered
Failedthe handler called context:error(...)
Erroredthe handler raised

No guards run here

:permission() and guards gate the manifest, server-side. Once a client command is delivered, execution is local and unchecked, which is why a client command must be safe to run arbitrarily.

A command whose module never arrived fails cleanly with a message naming the problem, rather than falling through to the server, which has no handler for it.

Released under the MIT Licence.