Roblox UtilitiesDevlHub Roblox Documentation

Class

NetworkServer

NotCreatableServiceNotReplicated
Inherits
NetworkPeer › Instance › Object
Memory category
Instances

A server-side service that manages all NetworkReplicator instances and handles incoming client connections.

The NetworkServer stores all the NetworkReplicator in the game and handles all connections. NetworkPeer:SetOutgoingKBPSLimit() can be used to imitate latency while using Start Server.

Methods 1#

EncryptStringForPlayerIdEncrypts a string with the session key of the connection belonging to the player with the given playerId, returning the ciphertext.

EncryptStringForPlayerId(toEncrypt: string, playerId: int64): string#

Encrypts toEncrypt using the per-session encryption key of the connected player whose Player.UserId equals playerId, then returns the ciphertext. Only that player's client can decrypt the result.

This supports the encrypted-assets workflow: the server session-encrypts an asset encryption key for a single player, and that client decrypts and registers it through ContentProvider:RegisterSessionEncryptedAsset() (or ContentProvider:RegisterDefaultSessionKey()), so the raw key is never transmitted in plain text.

Returns an empty string when no player with the given playerId is currently connected.

NameTypeDefaultDescription
toEncryptstringThe plain text string to encrypt, typically an asset encryption key.
playerIdint64The Player.UserId of the connected player whose session key is used to encrypt the string.
Returns
  • string — The session-encrypted string, or an empty string if no player with the given playerId is currently connected.

Inherited members#

Inherited from NetworkPeer 1
Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed