mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
239 lines
9.8 KiB
YAML
239 lines
9.8 KiB
YAML
# This file is automatically generated. Please don't edit it manually.
|
|
# To submit a bug report on the content, see
|
|
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
|
|
|
|
name: UnreliableRemoteEvent
|
|
type: class
|
|
memory_category: Instances
|
|
summary: |
|
|
An object which facilitates asynchronous, unordered and unreliable, one-way
|
|
communication across the client-server boundary. Scripts firing a
|
|
`Class.UnreliableRemoteEvent` do not yield.
|
|
description: |
|
|
The **UnreliableRemoteEvent** object is a variant of the `Class.RemoteEvent`
|
|
object. It facilitates asynchronous, unordered and unreliable, one-way
|
|
communication across the [client-server](../../../projects/client-server.md)
|
|
boundary without yielding for a response. This communication can be directed
|
|
from one client to the server, from the server to a specific client, or from
|
|
the server to all clients.
|
|
|
|
In order for both the server and clients to access a
|
|
`Class.UnreliableRemoteEvent` instance, it must be in a place where both sides
|
|
can see it, such as `Class.ReplicatedStorage`, although in some cases it's
|
|
appropriate to store it in `Class.Workspace` or inside a `Class.Tool`.
|
|
|
|
`Class.UnreliableRemoteEvent` is best used for ephemeral events, including
|
|
effects that are only relevant for a short time, or for replicating
|
|
continuously changing data. These events are not resent if they are lost and
|
|
they do not wait for previously fired events to arrive before being processed,
|
|
potentially resulting in reduced latency and network traffic. When you need
|
|
ordering and reliability, use a `Class.RemoteEvent` instead.
|
|
|
|
If no connected listener exists to handle an event, you might see a
|
|
`Remote event invocation discarded` error in the log to indicate that the
|
|
event was discarded and that you need to implement either `OnClientEvent` or
|
|
`OnServerEvent`.
|
|
|
|
#### Throttling
|
|
|
|
Remote events are subject to rate limits when sent from the client to the
|
|
server with the `Class.RemoteEvent:FireServer()|FireServer()` method.
|
|
`Class.RemoteEvent|RemoteEvents` and
|
|
`Class.UnreliableRemoteEvent|UnreliableRemoteEvents` both have a limit of
|
|
approximately 500 requests per second, per client. This limit is **shared
|
|
among all remote events of the same type**. To avoid throttling and latency
|
|
issues, limit recurring remote events whenever possible.
|
|
|
|
#### Parameter limitations
|
|
|
|
Any type of Roblox object (`Datatype.Enum`, `Class.Instance`, etc.) can be
|
|
passed as a parameter when an `Class.UnreliableRemoteEvent` is fired, as well
|
|
as Luau types such as numbers, strings, and booleans, although you should
|
|
carefully explore the
|
|
[limitations](../../../scripting/events/remote.md#argument-limitations).
|
|
|
|
Events with payloads larger than 1000 bytes are dropped. When this happens in
|
|
Studio, a log message in the [Output](../../../studio/output.md) window
|
|
indicates the number of bytes the event went over.
|
|
|
|
Like all events, the `Class.UnreliableRemoteEvent` methods encode and compress
|
|
certain object types, such as buffers, which shrinks the payload size and can
|
|
make it difficult to verify whether you are under the limit prior to firing
|
|
the event. If you frequently reach this limit, consider whether a standard
|
|
`Class.RemoteEvent` is the better fit for your use case.
|
|
code_samples: []
|
|
inherits:
|
|
- BaseRemoteEvent
|
|
descendants: []
|
|
tags: []
|
|
deprecation_message: ''
|
|
properties: []
|
|
methods:
|
|
- name: UnreliableRemoteEvent:FireAllClients
|
|
summary: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` event
|
|
for all connected clients. Has a 1000 byte limit to the payload of the
|
|
event. Events with larger payloads are dropped.
|
|
description: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` event
|
|
for all connected clients. Unlike
|
|
`Class.UnreliableRemoteEvent:FireClient()|FireClient()`, this event does
|
|
not take a target `Class.Player` as the first argument, since it fires to
|
|
multiple clients. Since this method is used to communicate from the server
|
|
to clients, it only works when used in a `Class.Script`.
|
|
code_samples: []
|
|
parameters:
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
Values to pass to all
|
|
`Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` events
|
|
connected to the same `Class.UnreliableRemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: UnreliableRemoteEvent:FireClient
|
|
summary: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` event
|
|
for a specific client. Has a 1000 byte limit to the payload of the event.
|
|
Events with larger payloads are dropped.
|
|
description: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` event
|
|
for the specific client in the required `Class.Player` argument. Since
|
|
this method is used to communicate from the server to a client, it only
|
|
works when used in a `Class.Script`.
|
|
code_samples: []
|
|
parameters:
|
|
- name: player
|
|
type: Player
|
|
default:
|
|
summary: |
|
|
The client of the `Class.Player` to fire the event to.
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
Values to pass to
|
|
`Class.UnreliableRemoteEvent.OnClientEvent|OnClientEvent` events
|
|
connected to the same `Class.UnreliableRemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: UnreliableRemoteEvent:FireServer
|
|
summary: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnServerEvent|OnServerEvent` event
|
|
on the server from one connected client. Has a 1000 byte limit to the
|
|
payload of the event. Events with larger payloads are dropped.
|
|
description: |
|
|
Fires the `Class.UnreliableRemoteEvent.OnServerEvent|OnServerEvent` event
|
|
on the server from one connected client. Connected events receive the
|
|
`Class.Player` argument of the firing client. Since this method is used to
|
|
communicate from a client to the server, it only works when used in a
|
|
client script.
|
|
code_samples: []
|
|
parameters:
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
Values to pass to
|
|
`Class.UnreliableRemoteEvent.OnServerEvent|OnServerEvent` events
|
|
connected to the same `Class.UnreliableRemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
events:
|
|
- name: UnreliableRemoteEvent.OnClientEvent
|
|
summary: |
|
|
Fires from a `Class.LocalScript` when either
|
|
`Class.UnreliableRemoteEvent:FireClient()|FireClient()` or
|
|
`Class.UnreliableRemoteEvent:FireAllClients()|FireAllClients()` is called
|
|
on the same `Class.UnreliableRemoteEvent` instance from a `Class.Script`,
|
|
although this firing is not guaranteed even if one of the above methods
|
|
are called. This can occur due to packet loss or to maintain optimal
|
|
engine performance.
|
|
description: |
|
|
Fires from a `Class.LocalScript` when either
|
|
`Class.UnreliableRemoteEvent:FireClient()|FireClient()` or
|
|
`Class.UnreliableRemoteEvent:FireAllClients()|FireAllClients()` is called
|
|
on the same `Class.UnreliableRemoteEvent` instance from a `Class.Script`,
|
|
although this firing is not guaranteed even if one of the above methods
|
|
are called. This can occur due to packet loss or to maintain optimal
|
|
engine performance.
|
|
|
|
Also note that it is not guaranteed that the order of events will match
|
|
the order of `Class.UnreliableRemoteEvent:FireClient()|FireClient()` or
|
|
`Class.UnreliableRemoteEvent:FireAllClients()|FireAllClients()` calls.
|
|
code_samples: []
|
|
parameters:
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
The parameters sent through
|
|
`Class.UnreliableRemoteEvent:FireClient()|FireClient()` or
|
|
`Class.UnreliableRemoteEvent:FireAllClients()|FireAllClients()`.
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: UnreliableRemoteEvent.OnServerEvent
|
|
summary: |
|
|
Fires from a `Class.Script` when
|
|
`Class.UnreliableRemoteEvent:FireServer()|FireServer()` is called on the
|
|
same `Class.UnreliableRemoteEvent` instance from a `Class.LocalScript`,
|
|
although this firing is not guaranteed even if the above methods is
|
|
called. This can occur due to packet loss or to maintain optimal engine
|
|
performance.
|
|
description: |
|
|
Fires from a `Class.Script` when
|
|
`Class.UnreliableRemoteEvent:FireServer()|FireServer()` is called on the
|
|
same `Class.UnreliableRemoteEvent` instance from a `Class.LocalScript`,
|
|
although this firing is not guaranteed even if the above methods is
|
|
called. This can occur due to packet loss or to maintain optimal engine
|
|
performance.
|
|
|
|
Also note that it is not guaranteed that the order of events will match
|
|
the order of `Class.UnreliableRemoteEvent:FireServer()|FireServer()`
|
|
calls.
|
|
code_samples: []
|
|
parameters:
|
|
- name: player
|
|
type: Player
|
|
default:
|
|
summary: |
|
|
The `Class.Player` associated with the client that the
|
|
`Class.UnreliableRemoteEvent:FireServer()|FireServer()` call
|
|
originates from.
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
The parameters sent through
|
|
`Class.UnreliableRemoteEvent:FireServer()|FireServer()`.
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
capabilities:
|
|
- RemoteEvent
|
|
callbacks: []
|