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
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.
Returns the remote's declared argument schema.
Returns this instance if it is an ExecutionGroup.
Calls a client callback from the server and yields until it returns or fails.
Calls the server callback from a client and yields until it returns.
Sets the remote's argument schema used for payload validation.
The client callback invoked by the server’s InvokeClient call.
The server callback.
Fires when a remote call is rejected by validation or rate limiting.
Properties
Channel
RemoteFunction.Channel: number = 0The 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 = 0The relative priority used to order or process this object.
RateLimit
RemoteFunction.RateLimit: number = 0The 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): ...anyCalls 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): ...anyCalls 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: RBXScriptSignalThe client callback invoked by the server’s InvokeClient call.
OnServerInvoke
RemoteFunction.OnServerInvoke: RBXScriptSignalThe 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: 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
Example
local request = Instance.new("RemoteFunction")
request.OnServerInvoke = function(player)
return player.UserId
end
request.Parent = game:GetService("ReplicatedStorage")