s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationNetworkingChat
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Networking
Networking

Platform Chat

Built-in text chat for multiplayer games. Messages are routed through the host, validated, filtered, and displayed via the standard overlay UI - no game code required.

The API lives in the Sandbox.Platform namespace.

Project Settings

Chat can be configured in Project Settings > Platform:

  • Chat Enabled - toggle the entire chat system on or off
  • Show Chat UI - hide the built-in overlay while still processing messages and firing events (useful for custom chat UIs)
  • Max Message Length - cap message length (up to 256 characters)

Sending Messages

Chat.Say( string message )

Send a chat message to the server. The host validates and broadcasts it to all connected players.

Chat.Say( "Hello everyone!" );

Chat.AddText( string message )

Add a local-only notification to the chat feed. Not networked.

Chat.AddText( $"{player.Name} joined the game" );

:::info Messages are automatically sanitized, rate-limited, and passed through Steam's text filter. Blocked users are filtered out on the receiving end. :::

Scene Events

Implement IChatEvent on a component to intercept, modify, suppress, or filter messages. This event fires in two places:

  • On the host - before broadcasting. You can modify the message, suppress it, or set a RecipientFilter.
  • On receiving clients - after delivery. You can still suppress the message to prevent it from showing in the UI.
public class TeamChat : Component, IChatEvent
{
    public void OnChatMessage( ChatMessageEvent e )
    {
        if ( !e.Message.StartsWith( "/team" ) )
            return;

        // Strip the command prefix
        e.Message = e.Message["/team ".Length..];

        // Only deliver to players on the same team
        var senderTeam = GetTeam( e.Sender );
        e.RecipientFilter = connection => GetTeam( connection ) == senderTeam;
    }
}

ChatMessageEvent

PropertyTypeDescription
MessagestringThe message text (mutable)
SenderConnectionWho sent it (null for system messages)
SuppressboolSet true to prevent delivery
RecipientFilterFunc<Connection, bool>Per-connection visibility (host only)

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2026-05-20. Read it rendered on the official docs.

More in Networking

Connection Permissions
Custom Snapshot Data
Dedicated Servers
Http Requests
Network Events
Network Helper
Network Visibility
Networked Objects
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.