Class
NetworkServer
NotCreatableServiceNotReplicated
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#
| EncryptStringForPlayerId | Encrypts 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.
| Name | Type | Default | Description |
|---|---|---|---|
toEncrypt | string | The plain text string to encrypt, typically an asset encryption key. | |
playerId | int64 | The 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 givenplayerIdis currently connected.
Inherited members#
Inherited from NetworkPeer 1
Methods (1)
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild