@rbxts/fletchette
    Preparing search index...

    Class SignalPacket<T>

    SignalPacket is a wrapper around RemoteEvent that provides a type-safe way to send data between server and client.

    Type Parameters

    • T

      The function signature for the signal

    Hierarchy (View Summary)

    Index

    Constructors

    • Create a SignalPacket with a unique id. Metadata can be provided to specify how the data should be serialized.

      Type Parameters

      • T

      Parameters

      • id: string

        Unique identifier for the signal

      • OptionalisUnreliable: boolean

        Whether the signal should be unreliable. Default is false.

      • Optionalmeta: Many<SerializerMetadata<Parameters<T>>>

        Metadata for serialization

      Returns SignalPacket<T>

    Properties

    className: "SignalPacket"

    Class name of the packet, used for debugging purposes.

    id: string

    Unique identifier for the signal

    remoteEvent: RemoteEvent

    RemoteEvent used to send the signal

    serializer: Serializer<Parameters<T>>

    Serializer for the data being sent by the signal

    virtualClientHandlers: Set<(...args: Parameters<T>) => void> = ...

    Set of virtual handlers that can be used to handle the signal on the client

    virtualServerHandlers: Set<(player: Player, ...args: Parameters<T>) => void> = ...

    Set of virtual handlers that can be used to handle the signal on the server

    Methods

    • Connect a server-side handler to the signal. Used by the server to listen for data from the client. Hence, this function should only be called on a server environment.

      Parameters

      • handler: (player: Player, ...args: Parameters<T>) => void

        The function to call when the signal is fired

      Returns RBXScriptConnection

    • Connect a client-side handler to the signal. Used by the client to listen for data from the server. Hence, this function should only be called on a client environment.

      Parameters

      • handler: (...args: Parameters<T>) => void

        The function to call when the signal is fired

      Returns RBXScriptConnection

      The connection object

    • Fire the signal to all players. Used by the server to send data to all clients.

      Parameters

      • ...args: Parameters<T>

        The data to send

      Returns void

    • Fire the signal to a specific player. Used by the server to send data to a client.

      Parameters

      • player: Player

        The player to send the signal to

      • ...args: Parameters<T>

        The data to send

      Returns void

    • Fire the signal to all players except one. Used by the server to send data to all clients except one.

      Parameters

      • player: Player

        The player to exclude

      • ...args: Parameters<T>

        The data to send

      Returns void

    • Fire the signal to a list of players. Used by the server to send data to a specific group of clients.

      Parameters

      • players: Player[]

        The list of players to send the signal to

      • ...args: Parameters<T>

        The data to send

      Returns void

    • Fire the signal to all players in a radius. Used by the server to send data to all clients within a certain radius.

      Parameters

      • position: Vector3

        The position to center the radius around

      • radius: number

        The radius to send the signal to

      • ...args: Parameters<T>

        The data to send

      Returns void

    • Inform the server of an event. Used by the client to send data to the server.

      Parameters

      • ...args: Parameters<T>

        The data to send

      Returns void