Class · inherits BaseRemoteEvent
RemoteEvent
An object which facilitates asynchronous, one-way communication across the
client-server boundary. Scripts firing a RemoteEvent do not yield.
About RemoteEvent
The RemoteEvent object facilitates asynchronous, one-way communication across the client-server 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 RemoteEvent
instance, it must be in a place where both sides can see it, such as
ReplicatedStorage, although in some cases it's appropriate to store it
in Workspace or inside a 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 UnreliableRemoteEvents,
RemoteEvents buffer a large number of events before
throwing this error.
If you need the result of the call, you should use a 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 for code samples and further details.
Throttling
Remote events are subject to rate limits when sent from the client to the
server with the FireServer() method.
RemoteEvents and
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 (Enum, Instance, etc.) can be
passed as a parameter when a RemoteEvent is fired, as well as Luau
types such as numbers, strings, and booleans, although you should carefully
explore the
limitations.
Methods 3
FireAllClients
(arguments: Tuple) → ()Fires theOnClientEventevent for each connected client.Fires the
OnClientEventevent for each connected client. UnlikeFireClient(), this event does not take a targetPlayeras 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 aScript.FireClient
(player: Player, arguments: Tuple) → ()Fires theOnClientEventevent for a specific client.Fires the
OnClientEventevent for the specific client in the requiredPlayerargument. Since this method is used to communicate from the server to a client, it only works when used in aScript.FireServer
(arguments: Tuple) → ()Fires theOnServerEventevent on the server from one connected client.Fires the
OnServerEventevent on the server from one client. Connected events receive thePlayerargument 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.
Events 2
OnClientEvent
RemoteEvent.OnClientEvent:Connect(function(arguments))Fires from aLocalScriptwhen eitherFireClient()orFireAllClients()is called on the sameRemoteEventinstance from aScript.Fires from a
LocalScriptwhen eitherFireClient()orFireAllClients()is called on the sameRemoteEventinstance from aScript.See Remote Events and Callbacks for code samples and further details on
OnClientEvent.OnServerEvent
RemoteEvent.OnServerEvent:Connect(function(player, arguments))Fires from aScriptwhenFireServer()is called on the sameRemoteEventinstance from aLocalScript.Fires from a
ScriptwhenFireServer()is called on the sameRemoteEventinstance from aLocalScript.See Remote Events and Callbacks for code samples and further details on
OnServerEvent.
RemoteEvent also has every member of BaseRemoteEvent. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.