RemoteEvent
RemoteEvent : Instance
Overview
A RemoteEvent is an Object used to handle events between the client and server, supporting asynchronous, one-way communication.
Since it needs to be accessible from both the server and the client, it should be placed in a shared location such as ReplicatedStorage or Workspace
Properties
Methods
FireAllClients
This method is used by the server to trigger the event connected to a RemoteEvent for all clients.
Since the event is sent to all clients, no Player argument is required.
Parameters
Tuple Arguments
These are the arguments passed to the function connected to the OnClientEvent of a RemoteEvent.
You can pass basic Luau data types such as number, boolean, string, and table.
Objects like Instances can also be passed.
However, not all data types are fully supported, so it's recommended to test how they behave before using them.
Return
void
Code Samples
FireClient
This method is used by the server to trigger the event connected to a specific client's RemoteEvent.
The Player argument must be provided to specify the target client.
If you want to trigger the event for all clients, it's more appropriate to use FireAllClients().
Parameters
Player Player
The Player that will trigger the client's event.
Tuple Arguments
These are the arguments passed to the function connected to the OnClientEvent of a RemoteEvent.
You can pass basic Luau data types such as number, boolean, string, and table.
Objects like Instances can also be passed.
However, not all data types are fully supported, so it's recommended to test how they behave before using them.
Return
void
Code Samples
FireServer
This method is used when a client triggers the event connected to a server-side RemoteEvent.
When the event is triggered, the connected function receives the Player Object of the client that sent the request as its first argument.
Parameters
Tuple Arguments
These are the arguments passed to the function connected to the OnServerEvent of a RemoteEvent.
You can pass basic Luau data types such as number, boolean, string, and table.
Objects like Instances can also be passed.
However, not all data types are fully supported, so it's recommended to test how they behave before using them.
Return
void
Code Samples
Events
OnClientEvent
When FireClient() or FireAllClients() is called on a RemoteEvent instance, all functions connected to its OnClientEvent are run, and the arguments provided during the call are passed along as-is.
Parameters
Code Samples
OnServerEvent
When FireServer() is called on a RemoteEvent instance, all functions connected to its OnServerEvent are run, and the arguments provided during the call are passed along as-is.
Parameters
Code Samples
See also
Server-Client CommunicationLast updated