Instances
RemoteFunction
Request/response communication between creator LocalScripts and ServerScripts.
Members
| Name | Type | Description |
|---|---|---|
MaxRequestsPerMinute | number | Maximum requests accepted per minute per Player. 0 disables the limit. |
Reliability | Enum.NetworkReliability | Reliable keeps ordered delivery. Unreliable may discard an older pending packet when superseded by a newer packet for the same remote and target. |
Payload | Enum.RemotePayload | Default permits every supported remote value type. Custom enforces AllowedPayloadTypes. |
AllowedPayloadTypes | array | Saved list of payload types allowed when Payload is Custom. Studio displays this list as checkboxes. |
Timeout | number | Hard native request timeout in seconds. The default is 30 seconds. A request that does not receive a response before the deadline raises a timeout error. |
NetworkPriority | Enum.NetworkPriority | Ranks queued remote traffic as High, Medium, Default, or Low. |
InvokeServer(...) | LocalScript | Calls the server callback and yields until its return values arrive. |
OnServerInvoke | ServerScript callback | Assign a function that receives the sending Player followed by the invocation arguments. |
InvokeClient(player, ...) | ServerScript | Calls one client's callback and yields until its return values arrive. |
OnClientInvoke | LocalScript callback | Assign a function that handles an invocation from the server. |
Example: client asks the server
Luau
-- ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getRound = ReplicatedStorage:WaitForChild("GetRound")
getRound.OnServerInvoke = function(player)
return 3, "Playing"
endLuau
-- LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getRound = ReplicatedStorage:WaitForChild("GetRound")
local round, state = getRound:InvokeServer()
print(round, state)Network configuration
Luau
-- ServerScript runtime configuration
getRound.MaxRequestsPerMinute = 30
getRound.Reliability = Enum.NetworkReliability.Reliable
getRound.Payload = Enum.RemotePayload.Custom
getRound.AllowedPayloadTypes = { "Number", "String", "Player" }
getRound.Timeout = 5
getRound.NetworkPriority = Enum.NetworkPriority.MediumWhen Payload is Custom, Studio shows checkboxes for Nil, Boolean, Number, String, Vector3, Color3, Instance, Player, and Table. The checked values are saved as an array.
For
Reliability = Enum.NetworkReliability.Unreliable, an invocation or response can be discarded when superseded before transmission. If that happens, the caller remains protected by Timeout.Arguments and returns
RemoteFunction arguments and return values support nil, booleans, numbers, strings, Vector3, Color3/Colour3, Instances, Players and nested tables containing supported values. Custom payload rules are enforced on both send and receive.
Only one callback is assigned to
OnServerInvoke or OnClientInvoke. Use a RemoteEvent when a return value is not needed.