Open Asterune
RemoteEvent

RemoteEvent

Sends asynchronous messages between the server and clients.

Creatable
Instance.new("RemoteEvent")
Inherits
Instance
Replication
Standard

Behavior

RemoteEvent sends messages without waiting for a return value. Create it on the server in ReplicatedStorage so both sides can access it. Clients can use WaitForChild to wait for replication.

Validate client arguments and permissions on the server before changing game state. See Server and client.

Summary

Members13
Properties4
  • Channel: number = 0parallel read

    The network channel used for the remote's messages.

  • DeliveryMode: string = "ReliableOrdered"parallel read

    The delivery policy used for the remote's messages.

  • Priority: number = 0parallel read

    The relative priority used to order or process this object.

  • RateLimit: number = 0parallel read

    The configured limit on remote calls.

Methods6
Events3
  • OnClientEvent: RBXScriptSignalparallel read

    Fires on a client after the server calls FireClient or FireAllClients.

  • OnServerEvent: RBXScriptSignalparallel read

    Fires on the server after a client calls FireServer.

  • Rejected: RBXScriptSignalparallel read

    Fires when a remote call is rejected by validation or rate limiting.

Properties

Channel

RemoteEvent.Channel: number = 0

The network channel used for the remote's messages.

DeliveryMode

RemoteEvent.DeliveryMode: string = "ReliableOrdered"

The delivery policy used for the remote's messages.

Priority

RemoteEvent.Priority: number = 0

The relative priority used to order or process this object.

RateLimit

RemoteEvent.RateLimit: number = 0

The configured limit on remote calls.

Methods

FireAllClients

RemoteEvent:FireAllClients(args: ...any): ()

Sends a message from the server to all connected clients.

FireClient

RemoteEvent:FireClient(player: Player, args: ...any): ()

Sends a message from the server to one client. Takes the target Player followed by message arguments.

FireServer

RemoteEvent:FireServer(args: ...any): ()

Sends arguments from a client to the server. The engine prepends the sending Player to the arguments received by OnServerEvent.

GetArgumentTypes

RemoteEvent:GetArgumentTypes(): { string }?

Returns the remote's declared argument schema.

GetExecutionGroup

RemoteEvent:GetExecutionGroup(): ExecutionGroup?

Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.

SetArgumentTypes

RemoteEvent:SetArgumentTypes(types: { string }?): ()

Sets the remote's argument schema used for payload validation.

Events

OnClientEvent

RemoteEvent.OnClientEvent: RBXScriptSignal

Fires on a client after the server calls FireClient or FireAllClients. Receives message arguments without a leading player argument.

OnServerEvent

RemoteEvent.OnServerEvent: RBXScriptSignal

Fires on the server after a client calls FireServer. Receives the sending Player followed by the client arguments.

Rejected

RemoteEvent.Rejected: RBXScriptSignal

Fires when a remote call is rejected by validation or rate limiting.

Inherited members

Inherited47

Examples

Luau
-- Server Script.
local remote = Instance.new("RemoteEvent")
remote.Name = "Ready"
remote.Parent = game:GetService("ReplicatedStorage")
remote.OnServerEvent:Connect(function(player)
  print(player.UserId)
end)
Luau
-- Server Script. Publishes a 60-second countdown through ReplicatedStorage.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remaining = Instance.new("RemoteEvent")
remaining.Name = "RoundRemaining"
remaining.Parent = ReplicatedStorage
local deadline = workspace.DistributedGameTime + 60
repeat
  local left = math.max(0, math.ceil(deadline - workspace.DistributedGameTime))
  remaining:FireAllClients(left)
  if left == 0 then
    break
  end
  task.wait(1)
until false

RemoteFunction · ReplicatedStorage · Player