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
The network channel used for the remote's messages.
The delivery policy used for the remote's messages.
The relative priority used to order or process this object.
The configured limit on remote calls.
Sends a message from the server to all connected clients.
Sends a message from the server to one client.
Sends arguments from a client to the server.
Returns the remote's declared argument schema.
Returns this instance if it is an ExecutionGroup.
Sets the remote's argument schema used for payload validation.
Fires on a client after the server calls FireClient or FireAllClients.
Fires on the server after a client calls FireServer.
Fires when a remote call is rejected by validation or rate limiting.
Properties
Channel
RemoteEvent.Channel: number = 0The 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 = 0The relative priority used to order or process this object.
RateLimit
RemoteEvent.RateLimit: number = 0The 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: RBXScriptSignalFires on a client after the server calls FireClient or FireAllClients. Receives message arguments without a leading player argument.
OnServerEvent
RemoteEvent.OnServerEvent: RBXScriptSignalFires on the server after a client calls FireServer. Receives the sending Player followed by the client arguments.
Rejected
RemoteEvent.Rejected: RBXScriptSignalFires when a remote call is rejected by validation or rate limiting.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Examples
-- Server Script.
local remote = Instance.new("RemoteEvent")
remote.Name = "Ready"
remote.Parent = game:GetService("ReplicatedStorage")
remote.OnServerEvent:Connect(function(player)
print(player.UserId)
end)-- 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