UnreliableRemoteEvent
*Nội dung này sẽ sớm có sẵn bằng ngôn ngữ bạn chọn.
The UnreliableRemoteEvent object is a variant of the RemoteEvent object. It facilitates asynchronous, unordered and unreliable, one-way communication across the client-server boundary without yielding for a response. This communication can be directed from one client to the server, from the server to a specific client, or from the server to all clients.
In order for both the server and clients to access a UnreliableRemoteEvent instance, it must be in a place where both sides can see it, such as ReplicatedStorage, although in some cases it's appropriate to store it in Workspace or inside a Tool.
UnreliableRemoteEvent is best used for ephemeral events including effects that are only relevant for a short time, or for replicating continuously changing data. These events are not resent if they are lost and they do not wait for previously fired events to arrive before being processed, potentially resulting in reduced latency and network traffic. When requiring ordering and reliability, use a RemoteEvent instead.
Parameter Limitations
Any type of Roblox object such as an Enum, Instance, or others can be passed as a parameter when a UnreliableRemoteEvent is fired, as well as Luau types such as numbers, strings, and booleans, although you should carefully explore the limitations.
There is a 900 byte limit to the payload of an UnreliableRemoteEvent. Larger payloads are dropped. Like all events, the UnreliableRemoteEvent methods encode and compress certain object types, such as buffers, which shrinks the payload size and can make it difficult to verify whether you are under the limit prior to firing the event. If you frequently reach this limit, consider whether a standard RemoteEvent is the better fit for your use case.
Tóm Tắt
Phương Pháp
Fires the OnClientEvent event for each client connected to the same UnreliableRemoteEvent. Has a 900 byte limit to the payload of the event, otherwise event is dropped.
Fires the OnClientEvent event for a specific client connected to the same UnreliableRemoteEvent. Has a 900 byte limit to the payload of the event, otherwise event is dropped.
Fires the OnServerEvent event on the server from one client connected to the same UnreliableRemoteEvent. Has a 900 byte limit to the payload of the event, otherwise event is dropped.
Sự Kiện
Fires from a LocalScript when either FireClient() or FireAllClients() is called on the same UnreliableRemoteEvent instance from a Script, although this firing is not guaranteed even if one of the above methods are called. This can occur due to packet loss or to maintain optimal engine performance.
Fires from a Script when FireServer() is called on the same UnreliableRemoteEvent instance from a LocalScript, although this firing is not guaranteed even if the above methods is called. This can occur due to packet loss or to maintain optimal engine performance.
Thuộc Tính
Phương Pháp
FireAllClients
Fires the OnClientEvent event for each client connected to the same UnreliableRemoteEvent. Unlike FireClient(), this event does not take a target Player as the first argument, since it fires to multiple clients. Since this method is used to communicate from the server to clients, it will only work when used in a Script.
Any type of Roblox object such as an Enum, Instance, or others can be passed as a parameter to FireAllClients(), as well as Luau types such as numbers, strings, and booleans, although you should carefully explore the limitations.
Events with payloads larger than 900 bytes will be dropped. When this happens in Studio, a log message in the Output window will indicate by how many bytes the event has gone over.
Tham Số
Values to pass to all OnClientEvent events connected to the same UnreliableRemoteEvent.
Lợi Nhuận
FireClient
Fires the OnClientEvent event for one connected client specified by the required Player argument. Since this method is used to communicate from the server to a client, it will only work when used in a Script.
Any type of Roblox object such as an Enum, Instance, or others can be passed as a parameter to FireClient(), as well as Luau types such as numbers, strings, and booleans, although you should carefully explore the limitations.
Events with payloads larger than 900 bytes will be dropped. When this happens in Studio, a log message in the Output window will indicate by how many bytes the event has gone over.
See also FireAllClients() which works similarly but fires the event for each client connected to the same UnreliableRemoteEvent.
Tham Số
Values to pass to OnClientEvent events connected to the same UnreliableRemoteEvent.
Lợi Nhuận
FireServer
Fires the OnServerEvent event on the server from one client. Connected events receive the Player argument of the firing client. Since this method is used to communicate from a client to the server, it will only work when used in a LocalScript.
Any type of Roblox object such as an Enum, Instance, or others can be passed as a parameter to FireServer(), as well as Luau types such as numbers, strings, and booleans, although you should carefully explore the limitations.
Events with payloads larger than 900 bytes will be dropped. When this happens in Studio, a log message in the Output window will indicate by how many bytes the event has gone over.
Tham Số
Values to pass to OnServerEvent events connected to the same UnreliableRemoteEvent.
Lợi Nhuận
Sự Kiện
OnClientEvent
Fires from a LocalScript when either FireClient() or FireAllClients() is called on the same UnreliableRemoteEvent instance from a Script, although this firing is not guaranteed even if one of the above methods are called. This can occur due to packet loss or to maintain optimal engine performance.
Also note that it is not guaranteed that the order of events will match the order of FireClient() or FireAllClients() calls.
Tham Số
The parameters sent through FireClient() or FireAllClients().
OnServerEvent
Fires from a Script when FireServer() is called on the same UnreliableRemoteEvent instance from a LocalScript, although this firing is not guaranteed even if the above methods is called. This can occur due to packet loss or to maintain optimal engine performance.
Also note that it is not guaranteed that the order of events will match the order of FireServer() calls.
Tham Số
The Player associated with the client that the FireServer() call originates from.
The parameters sent through FireServer().