:Update

Updates an existing data entry on the server. Any clients currently listening to this realKey (and match the target criteria) will receive the update.

All updates are queued and sent efficiently in a single batch per player at the end of the server tick, ensuring minimal network overhead.


DataReplicator:Update(realKey: string, data: any, target?, exceptTarget?)


  • realKey: string

    The key of the data to update. The key must have been previously created or registered.

  • data: any

    The new data. This will completely overwrite the previous data for this key.

  • target: Player | {Player} | "All" | "AllExcept" | nil (Optional)

    Specifies which clients should receive this update.

    • nil (Default): Sends to all clients that are currently listening to this specific realKey.

    • Player: Sends only to the specified player (if they are listening).

    • {Player} (Table of Players): Sends to all players in the table (if they are listening).

    • "All": Sends to all online players who are listening.

    • "AllExcept": Sends to all online players except those specified in the exceptTarget parameter (if they are listening).

  • exceptTarget: Player | {Player} | nil (Optional)

    Used only when target is set to "AllExcept". Specifies which player or table of players to exclude from the update.

Last updated