PackageHandlers||doc136730

September 20, 2022

PackageHandlers

Global singleton

The protocol can only transfer information across terminals. If you need to transfer information at the same end, please use theBindableEvent

Brief Introduction

The communication protocol service is mainly used for the mutual communication between the client and the server. It is usually used to synchronize some information between the client and the server. The client can send a message to the server, or the server can send a message to the client. There are both sending and receiving messages. Sending messages is meaningful only after the function of receiving messages is written. Just like throwing a ball at others, others should be prepared to catch the ball in advance before it can be delivered correctly.

Function

void SendToClientEntity player, string packetName, table<variant> packet ) [ServerOnly]
The server sends the protocol to a single client
void SendToAllClientsstring packetName, table<variant> packet ) [ServerOnly]
The server sends protocols to all clients
void SendToTrackingClientsEntity entity, string packetName, table<variant> packet ) [ServerOnly]
The server sends protocols to all clients within the synchronization range of an entity
void SendToServerstring packetName, table<variant> packet ) [ClientOnly]
Client sends protocol to server
void Receivestring packetName, function callback )
Receive protocols from the other end