Core Concepts

The Client Table: Methods, Signals, Properties

This is the feature that replaces manually wiring up RemoteEvent/RemoteFunction instances. A service can declare a Client table describing exactly what it exposes to clients.

local MoneyService = Thread.CreateService({
    Name = "MoneyService",
    Client = {
        -- 1) A METHOD: the client calls this and gets a return value back.
        GetMoney = function(self, player)
            return self.Server:GetMoney(player)
        end,

        -- 2) A SIGNAL: a one-off push event, server -> client.
        MoneyChanged = Thread.CreateSignal(),

        -- 3) A PROPERTY: a value kept in sync with clients automatically.
        Jackpot = Thread.CreateProperty(0),
    },
})
  • Every Client method receives self (the Client table itself — not the outer service) and player (automatically injected — the client can't fake this) as its first two arguments, then whatever the client passed.
  • self.Server is a back-reference to the outer service table, so a Client method can call the "real" implementation: self.Server:GetMoney(player).
  • Thread.CreateSignal() / Thread.CreateProperty(v) are just markers. When Thread.Start() calls Channel.WrapService, it walks the Client table and replaces each marker in place with a real Signal/Property object.
  • Thread.CreateSignal, Thread.CreateUnreliableSignal, and Thread.CreateProperty are literally the same functions as Channel.CreateSignal/Channel.CreateUnreliableSignal/Channel.CreateProperty — re-exported for convenience.

Which one do I use?

SituationUse
Client asks a one-time question and needs an answer ("how much money do I have?")Method
Server wants to push a one-off event ("you leveled up", "explosion at X")Signal
A value needs to stay in sync and be readable at any time, including for a client who joins lateProperty
A cosmetic, high-frequency event where occasional packet loss is fine (footstep VFX)UnreliableSignal (Thread.CreateUnreliableSignal())

Using a Signal

-- Server
function MoneyService:GiveMoney(player, amount)
    balances[player] = self:GetMoney(player) + amount
    self.Client.MoneyChanged:Fire(player, balances[player])       -- to one player
    self.Client.MoneyChanged:FireAll(balances[player])             -- to everyone
    self.Client.MoneyChanged:FireExcept(player, balances[player])  -- to everyone but `player`
end
-- Client
MoneyService.MoneyChanged:Connect(function(newBalance)
    print("New balance:", newBalance)
end)

A Signal built from Thread.CreateSignal() can also be fired from the client back to the server (MoneyService.SomeSignal:Fire(...) on the client) — it's a two-way object, just used one-directionally above. On the server, :Connect(fn) receives (player, ...).

Using a Property

-- Server
self.Client.Jackpot:Set(500)              -- new value, broadcast to everyone (see override note below)
local current = self.Client.Jackpot:Get() -- read the shared default back

-- Per-player overrides (e.g. a personalized value only one player sees):
self.Client.Jackpot:SetFor(player, 9999)
self.Client.Jackpot:GetFor(player)     -- 9999 for that player, the default for everyone else
self.Client.Jackpot:ClearFor(player)   -- back to the shared default
-- Client
print(MoneyService.Jackpot:Get())  -- last known value, synchronously

MoneyService.Jackpot:Observe(function(value)
    print("Jackpot is now", value)
end)
-- Observe calls your function IMMEDIATELY with the current value, then again
-- on every future change. Always use Observe over a manual :Get() + polling.

Property:Set(value) broadcasts to every currently-connected client except those with an active :SetFor override — so setting the shared default never clobbers a personalized value. A newly-created Property fetches its own current value synchronously the first time a client builds it, so late-joining players never see a stale/default value.

There's also Property:Destroy() (both sides), which disconnects the internal PlayerRemoving connection a server-side Property keeps around to clean up per-player overrides. You won't normally call this directly — Channel.Destroy(serviceName) tears down the underlying Remotes for you.

How Networking Actually Works Under the Hood

Understanding this makes debugging a lot easier.

  1. The first time Channel.luau loads (server or client), it creates (or, on the client, waits for) a folder at ReplicatedStorage.ThreadChannel. All Remote instances live under here.
  2. When the server calls Channel.WrapService("MoneyService", clientTable, opts), for every key in clientTable it creates one Remote object per key, under a namespaced folder: e.g. a Method named GetMoney becomes a RemoteFunction at ReplicatedStorage.ThreadChannel.RemoteFunction.MoneyService.GetMoney. Namespacing by service name means two different services can both expose a method called GetMoney without colliding.
  3. Every Remote gets a Roblox Attribute called ThreadKind set to "Method", "Signal", or "Property". This is how the client later figures out how to wrap each Remote — pure metadata, doesn't touch Lua state at all.
  4. After every Remote has been created and the service lifecycle succeeds, Thread creates a ready marker at ReplicatedStorage.ThreadChannel.Services.<ServiceName>.
  5. Channel.BuildClient("MoneyService") waits for that ready marker, reads its exact JSON manifest, waits for every listed Remote, and builds the appropriate wrappers. This prevents incomplete or uninitialized proxies.

Generated Typed Clients

Service contracts declared in thread.config.json generate a typed facade at Thread.Clients. Use Thread.Clients.InventoryService() or Thread.Clients.BuildClient("InventoryService") to receive the generated method, Signal, and Property types without a manual cast. Services omitted from the configuration remain available through Thread.Channel.BuildClient as dynamic proxies.

Errors, Validators, and Payload Limits

Wrapped Methods preserve legitimate nil results. Middleware rejection, rate limiting, validation failure, oversized payloads, and handler failure each produce a structured error with a stable Code. Catch calls with pcall and check Channel.IsRemoteError(errorValue).

Use a service's RemotePolicies table to assign Arguments validators, AllowExtraArguments, RateLimit, or MaxPayloadBytes to one Method or Signal. Built-ins are available through Thread.Validators.

At runtime, the server's Client table creates the Remote hierarchy. When a generated contract exists, Thread verifies that hierarchy against it before publishing the service, preventing the static type and runtime API from silently diverging.