NetworkService
Reports transport, connection state, traffic, and network timing.
- Service
game:GetService("NetworkService")- Inherits
- Instance
- Replication
- Never
Behavior
NetworkService reports transport, connection state, traffic, and network timing.
Summary
The number of connected clients.
Whether the client currently has an active server connection.
The active client, server, or standalone networking mode.
The measured connection round-trip time, in milliseconds.
The network port used by the server.
The cumulative number of bytes received.
The cumulative number of bytes sent.
The server's simulation tick rate.
The synchronized server time.
The active network transport identifier.
Returns the number of connected network clients.
Returns "Excellent", "Good", "Fair", "Poor", or "Bad", or nil when no connection matches.
Returns information about the active network connections.
Returns this instance if it is an ExecutionGroup.
Returns network traffic and timing statistics.
Fires when the network connection state changes.
Properties
ClientCount
NetworkService.ClientCount: number = 0The number of connected clients.
Connected
NetworkService.Connected: boolean = falseWhether the client currently has an active server connection.
Mode
NetworkService.Mode: string = "Offline"The active client, server, or standalone networking mode.
Ping
NetworkService.Ping: number = 0The measured connection round-trip time, in milliseconds.
Port
NetworkService.Port: number = 0The network port used by the server.
ReceivedBytes
NetworkService.ReceivedBytes: number = 0The cumulative number of bytes received.
SentBytes
NetworkService.SentBytes: number = 0The cumulative number of bytes sent.
ServerTickRate
NetworkService.ServerTickRate: number = 60The server's simulation tick rate.
ServerTime
NetworkService.ServerTime: number = 0The synchronized server time.
Transport
NetworkService.Transport: string = "offline"The active network transport identifier.
Methods
GetClientCount
NetworkService:GetClientCount(): numberReturns the number of connected network clients.
GetConnectionQuality
NetworkService:GetConnectionQuality(player: Player?): ConnectionQualityReturns "Excellent", "Good", "Fair", "Poor", or "Bad", or nil when no connection matches. Accepts a Player, user identifier, or no argument. With no argument, a client uses its server connection; a server selects its worst connection.
GetConnections
NetworkService:GetConnections(): tableReturns information about the active network connections.
GetExecutionGroup
NetworkService:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
GetStats
NetworkService:GetStats(): tableReturns network traffic and timing statistics.
Events
ConnectionChanged
NetworkService.ConnectionChanged: RBXScriptSignalFires when the network connection state changes.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying