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
| Name | Type | Description |
|---|---|---|
| eventName | string | The event's name on the server. |
| bandwidth | int | Bytes per second, from 1. Anything over 128 KB a second counts as 128 KB.default 5000 |
| persist | bool | Keep sending after this resource stops. With false, the transfer is cancelled when the resource stops.default false |
| source | element | An element that exists on the server. |
| ... | any | Arguments 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).