M MY Multiplayer: Wiki
Side
Kind

triggerLatentServerEvent

Client

Sends an event to the server bit by bit, in the background, at no more than bandwidth bytes a second. Meant for large data that must not hold up the rest of the traffic.

bool triggerLatentServerEvent(string eventName, element source, any ... [, int bandwidth = 5000, bool persist = false])

Parameters

NameTypeDescription
eventNamestringThe event's name on the server.
bandwidthintBytes per second, from 1. Anything over 128 KB a second counts as 128 KB.default 5000
persistboolKeep sending after this resource stops. With false, the transfer is cancelled when the resource stops.default false
sourceelementAn element that exists on the server.
...anyArguments passed to the handlers on the other side: nil, booleans, numbers, strings, elements, vectors and tables of them.

Returns

true if the event was queued, false if there is no connection to a server, it is over 16 MB, or source or an argument is an element created only on this client.

Latent events to the same destination go out one at a time, in the order they were triggered. getLatentEventHandles gives each one's handle, to follow with getLatentEventStatus or stop with cancelLatentEvent.

Example

local drawing = { width = 512, height = 512, strokes = {} }

triggerLatentServerEvent("onPlayerSaveDrawing", 20000, localPlayer, drawing)
NoteThe server only accepts the event if it registered it with addEvent(eventName, true).

See also