mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
209 lines
7.8 KiB
YAML
209 lines
7.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: RemoteEvent
|
|
type: class
|
|
memory_category: Instances
|
|
summary: |
|
|
An object which facilitates asynchronous, one-way communication across the
|
|
client-server boundary. Scripts firing a `Class.RemoteEvent` do not yield.
|
|
description: |
|
|
The **RemoteEvent** object facilitates asynchronous, 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.RemoteEvent`
|
|
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`.
|
|
|
|
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`. Unlike `Class.UnreliableRemoteEvent|UnreliableRemoteEvents`,
|
|
`Class.RemoteEvent|RemoteEvents` buffer a large number of events before
|
|
throwing this error.
|
|
|
|
If you need the result of the call, you should use a `Class.RemoteFunction`
|
|
instead. Otherwise a remote event is recommended since it will minimize
|
|
network traffic/latency and won't yield the script to wait for a response.
|
|
|
|
See [Remote events and callbacks](../../../scripting/events/remote.md) for
|
|
code samples and further details.
|
|
|
|
#### 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 a `Class.RemoteEvent` 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).
|
|
code_samples: []
|
|
inherits:
|
|
- BaseRemoteEvent
|
|
descendants: []
|
|
tags: []
|
|
deprecation_message: ''
|
|
properties: []
|
|
methods:
|
|
- name: RemoteEvent:FireAllClients
|
|
summary: |
|
|
Fires the `Class.RemoteEvent.OnClientEvent|OnClientEvent` event for each
|
|
connected client.
|
|
description: |
|
|
Fires the `Class.RemoteEvent.OnClientEvent|OnClientEvent` event for each
|
|
connected client. Unlike `Class.RemoteEvent: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.RemoteEvent.OnClientEvent|OnClientEvent`
|
|
events connected to the same `Class.RemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: RemoteEvent:FireClient
|
|
summary: |
|
|
Fires the `Class.RemoteEvent.OnClientEvent|OnClientEvent` event for a
|
|
specific client.
|
|
description: |
|
|
Fires the `Class.RemoteEvent.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.RemoteEvent.OnClientEvent|OnClientEvent`
|
|
events connected to the same `Class.RemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: RemoteEvent:FireServer
|
|
summary: |
|
|
Fires the `Class.RemoteEvent.OnServerEvent|OnServerEvent` event on the
|
|
server from one connected client.
|
|
description: |
|
|
Fires the `Class.RemoteEvent.OnServerEvent|OnServerEvent` event on the
|
|
server from one 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.RemoteEvent.OnServerEvent|OnServerEvent`
|
|
events connected to the same `Class.RemoteEvent`.
|
|
returns:
|
|
- type: ()
|
|
summary: ''
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
thread_safety: Unsafe
|
|
capabilities:
|
|
- RemoteEvent
|
|
events:
|
|
- name: RemoteEvent.OnClientEvent
|
|
summary: |
|
|
Fires from a `Class.LocalScript` when either
|
|
`Class.RemoteEvent:FireClient()|FireClient()` or
|
|
`Class.RemoteEvent:FireAllClients()|FireAllClients()` is called on the
|
|
same `Class.RemoteEvent` instance from a `Class.Script`.
|
|
description: |
|
|
Fires from a `Class.LocalScript` when either
|
|
`Class.RemoteEvent:FireClient()|FireClient()` or
|
|
`Class.RemoteEvent:FireAllClients()|FireAllClients()` is called on the
|
|
same `Class.RemoteEvent` instance from a `Class.Script`.
|
|
|
|
See [Remote Events and Callbacks](../../../scripting/events/remote.md) for
|
|
code samples and further details on
|
|
`Class.RemoteEvent.OnClientEvent|OnClientEvent`.
|
|
code_samples: []
|
|
parameters:
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
The parameters sent through
|
|
`Class.RemoteEvent:FireClient()|FireClient()` or
|
|
`Class.RemoteEvent:FireAllClients()|FireAllClients()`.
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
capabilities:
|
|
- RemoteEvent
|
|
- name: RemoteEvent.OnServerEvent
|
|
summary: |
|
|
Fires from a `Class.Script` when
|
|
`Class.RemoteEvent:FireServer()|FireServer()` is called on the same
|
|
`Class.RemoteEvent` instance from a `Class.LocalScript`.
|
|
description: |
|
|
Fires from a `Class.Script` when
|
|
`Class.RemoteEvent:FireServer()|FireServer()` is called on the same
|
|
`Class.RemoteEvent` instance from a `Class.LocalScript`.
|
|
|
|
See [Remote Events and Callbacks](../../../scripting/events/remote.md) for
|
|
code samples and further details on
|
|
`Class.RemoteEvent.OnServerEvent|OnServerEvent`.
|
|
code_samples: []
|
|
parameters:
|
|
- name: player
|
|
type: Player
|
|
default:
|
|
summary: |
|
|
The `Class.Player` associated with the client that the
|
|
`Class.RemoteEvent:FireServer()|FireServer()` call originates from.
|
|
- name: arguments
|
|
type: Tuple
|
|
default:
|
|
summary: |
|
|
The parameters sent through
|
|
`Class.RemoteEvent:FireServer()|FireServer()`.
|
|
tags: []
|
|
deprecation_message: ''
|
|
security: None
|
|
capabilities:
|
|
- RemoteEvent
|
|
callbacks: []
|