Open Asterune
RemoteFunction

RemoteFunction

Calls a remote callback and waits for its return value.

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

Behavior

RemoteFunction sends a request between a client and the server. The calling thread yields until the remote callback returns or the call fails. Unanswered calls time out after 600 seconds. Assign a callback to OnServerInvoke or OnClientInvoke; these are callback properties.

Use RemoteEvent when the caller does not need to wait for a return value.

Summary

Members12
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.

Methods5
Events3

Properties

Channel

RemoteFunction.Channel: number = 0

The network channel used for the remote's messages.

DeliveryMode

RemoteFunction.DeliveryMode: string = "ReliableOrdered"

The delivery policy used for the remote's messages.

Priority

RemoteFunction.Priority: number = 0

The relative priority used to order or process this object.

RateLimit

RemoteFunction.RateLimit: number = 0

The configured limit on remote calls.

Methods

GetArgumentTypes

RemoteFunction:GetArgumentTypes(): { string }?

Returns the remote's declared argument schema.

GetExecutionGroup

RemoteFunction:GetExecutionGroup(): ExecutionGroup?

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

InvokeClient

RemoteFunction:InvokeClient(player: Player, args: ...any): ...any

Calls a client callback from the server and yields until it returns or fails. An unanswered call times out after 600 seconds. Avoid depending on a client response for server progress.

InvokeServer

RemoteFunction:InvokeServer(args: ...any): ...any

Calls the server callback from a client and yields until it returns. Callback errors and a 600-second timeout propagate to the caller. Use pcall when the caller must handle failure.

SetArgumentTypes

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

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

Events

OnClientInvoke

RemoteFunction.OnClientInvoke: RBXScriptSignal

The client callback invoked by the server’s InvokeClient call.

OnServerInvoke

RemoteFunction.OnServerInvoke: RBXScriptSignal

The server callback. Receives the calling Player followed by client arguments. Its return value is sent to the caller. Reassignment replaces the previous callback. Validate client arguments before use.

Rejected

RemoteFunction.Rejected: RBXScriptSignal

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

Inherited members

Inherited47

Example

Luau
local request = Instance.new("RemoteFunction")
request.OnServerInvoke = function(player)
  return player.UserId
end
request.Parent = game:GetService("ReplicatedStorage")

RemoteEvent · ReplicatedStorage · Player