Lesson 11 of 12
Players, characters, teams and chat
Players, characters, teams and chat in a Roblox game. Follow Beacon Yard's join flow and Drillers team, post system lines with TextChatService, filter player text, and meet today's chat age checks.
By the end you can
- Follow a player from PlayerAdded to a spawned character, and key saved data by UserId
- Create a Team under the Teams service and assign players to it
- Send system messages and add a chat command through TextChatService, and filter any text players write with TextService
- Explain the current chat age-check rules and check chat permissions before showing chat features
Before this: Coins: touch, debounce, respawn, leaderstats, Security: never trust the client
1Two players, one yard
Start a Studio Server & Clients playtest with 2 clients (from the playtest dropdown in the toolbar). Both windows show the cyan Drillers team in the player list. One player collects a coin and only their number goes up. One starts a drill, and both chat windows say Drill started.
Two players join one server: same team, separate coins, one system line in both chats.
Transcript
- 0:00 Team Test joins two players to one server.
- 0:04 Both land on the cyan Drillers team.
- 0:07 Player2 picks up a coin. Player1's list shows 35 become 40.
- 0:14 A drill tries to write a system line on RBXGeneral.
- 0:22 RBXGeneral exists here, so both chats show Drill started.
Who "says" Drill started in the chat window?
Answer
Nobody: each client draws a system message when the server tells it to. It is a system line, not a player speaking. The server fires Feedback with kind announce, and each client writes the text into its own chat window.
Open this step in lesson mode · Link to this step · This confused me
2From joining to a body
The Players service holds a Player object for everyone in this server. PlayerAdded fires when someone joins; PlayerRemoving when they leave1. A player is not their body. The body is a separate Model with a Humanoid, the character, created when they spawn and replaced each time they respawn. player.CharacterAdded fires for each new one.
function DataService.applySpeed(player: Player)
local profile = profiles[player]
local character = player.Character
if not profile or not character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
humanoid.WalkSpeed = if profile.speedOwned then Config.BOOST_SPEED else Config.WALK_SPEED
DataService keys every saved profile by player.UserId, a number that stays stable for that player in this game. The display name on the player list can change; a profile saved under it would be lost when it does2.
Put a player's arrival in Beacon Yard in order.
Answer
1. Players.PlayerAdded fires on the server 2. TeamService sets player.Team to Drillers 3. The character spawns at the neutral Spawn 4. player.CharacterAdded fires, and DataService sets WalkSpeed from the profile. The Player object exists first. Its team is set straight away, then the character spawns, and anything about the body (WalkSpeed) waits for CharacterAdded.
Open this step in lesson mode · Link to this step · This confused me
3A team is an instance under Teams
Teams are not a folder you invent. A Team instance must be a child of the Teams service; its Name and TeamColor show on the player list, and AutoAssignable places joiners on it3. TeamService makes one team, Drillers, cyan, and assigns everyone.
function TeamService.start()
local existing = Teams:FindFirstChild("Drillers")
local team = if existing ~= nil and existing:IsA("Team") then existing else Instance.new("Team")
team.Name = "Drillers"
team.TeamColor = BrickColor.new("Cyan")
team.AutoAssignable = true
team.Parent = Teams
The yard's Spawn is Neutral, so any team can spawn there, and its Duration is 0, so a fresh character gets no spawn ForceField that would block the drone.

Select a numbered pin, or a row below, to read what it marks.
The player list groups players under the Drillers team row.
A teammate refactors TeamService and parents the Team to Workspace instead. What does the player list show?
team.Parent = workspace
Answer
No team rows; a Team only counts under the Teams service. The engine only treats Team instances under Teams as teams. In Workspace it is just an object, and players' Team property cannot point at a real team.
Open this step in lesson mode · Link to this step · This confused me
4Chat goes through TextChatService
TextChatService runs in-game chat: the window, bubbles, channels, filtering, moderation and permissions4. New experiences use TextChatService as their only chat system, enabled automatically, and it creates the RBXGeneral and RBXSystem channels. Beacon Yard still sets the ChatVersion property in two places. The project file writes ChatVersion = TextChatService into the place file that rojo build makes, as a guard for a place created before the switch. AnnounceService.start also tries to set it, inside pcall. That second attempt can never succeed, because game scripts are not allowed to write ChatVersion5; the pcall keeps it harmless. The property is deprecated for new experiences, so a place you create today needs neither line.
TextChannel:DisplaySystemMessage only works on a client, and shows the line only to that user. So the server does not call it. AnnounceService.say fires the Feedback remote to every client with kind announce, and SoundClient on each client writes the line into RBXGeneral.
if kind == "announce" and typeof(text) == "string" and text ~= "" then
local textChat = game:GetService("TextChatService")
local channels = textChat:FindFirstChild("TextChannels")
local general = if channels then channels:FindFirstChild("RBXGeneral") else nil
if general ~= nil and general:IsA("TextChannel") then
pcall(function()
general:DisplaySystemMessage(text)
Why does AnnounceService not call DisplaySystemMessage on the server?
Answer
DisplaySystemMessage only runs on a client and shows the line to that client only. It is a client-only method for that user's own window. To reach everyone, the server tells every client and each one displays it.
Open this step in lesson mode · Link to this step · This confused me
5Filter every word players write
Roblox filters messages that go through text chat for you. Anything else that players write and other players see, you must filter yourself: a crate name, a sign, a pet's name, a team motto. The docs are blunt: if Roblox finds a game that shows unfiltered text, the game is removed until it filters6.
Filtering is a server job. The client sends the text in a remote; the server calls TextService:FilterStringAsync(text, player.UserId), which yields and can fail, and then asks the result for the right version7:
GetNonChatStringForBroadcastAsync()for text everyone will see, such as a sign.GetNonChatStringForUserAsync(userId)for text one particular user will see.
local TextService = game:GetService("TextService")
local function filteredForEveryone(player: Player, text: string): string?
local ok, result = pcall(function()
return TextService:FilterStringAsync(text, player.UserId)
end)
if not ok then
return nil
end
local shown, filtered = pcall(function()
return result:GetNonChatStringForBroadcastAsync()
end)
return if shown then filtered else nil
end
A crate name arrives at the server like a note at the front desk. The engine stamps who sent it, and every word on it is untrusted until the clerk has checked it.
Think of it as A note to the front-desk clerk
Both sidesRemember: A RemoteEvent is a note to the front-desk clerk.
If either call fails, show nothing: never fall back to the raw text. Text players can edit is also a way to chat, so the chat guidelines require a rate limit of at least one minute between submissions per player, on top of filtering8. Text you write yourself, like Drill started, needs no filter.
This server code puts a player's crate name on a sign everyone can see. Which line breaks the rules?
local ok, result = pcall(TextService.FilterStringAsync, TextService, name, player.UserId)
local label = sign.SurfaceGui.TextLabel
if not ok then
label.Text = name
else
local shown, text = pcall(result.GetNonChatStringForBroadcastAsync, result)
label.Text = if shown then text else ""
end
Answer
Line 4: label.Text = name. Fixed: label.Text = "" -- show nothing when filtering fails. Falling back to the raw name shows unfiltered text the moment the filter service hiccups. Show nothing, or a fixed placeholder, and try again later.
Open this step in lesson mode · Link to this step · This confused me
6Chat and age checks today
As of November 2026, Roblox requires every user to complete an age check, by facial age estimation or ID verification, before they can use experience chat, voice chat or friends chat. Users without one have chat off. Age-checked users chat with people in similar age groups (5 to 8, 9 to 12, 13 to 15, 16 to 17, 18 to 20, 21 and over) and with Trusted Friends, and younger users need a parent's consent for some chat settings. The groups and settings can vary by region910.
For you as a developer, the rule is short: let TextChatService do this, and never build a way around it. The chat guidelines say chat must go through TextChatService, which applies privacy settings, age-based limits, filtering and reporting automatically. Before you show a chat button or a "message this player" feature, ask TextChatService:CanUserChatAsync(userId) or, for two players, CanUsersChatAsync(fromId, toId), and hide it when the answer is false. Both methods are server-only and a chat button lives on the client, so ask on the server and send the answer to the client8.
One more change is scheduled: from May 2027, platform-integrated chat will be required for all games. With it, Roblox renders all chat and your code can no longer read message text11. Beacon Yard only posts system lines, so it is ready.
Which of these are true for a Roblox game today?
Answer
A player without an age check has chat off, whatever your game does; CanUserChatAsync tells you whether to show chat features to a player. Roblox enforces age checks inside TextChatService; your job is to route chat through it and respect CanUserChatAsync. Fast player-to-player text outside it is chat, and filtering alone does not make it allowed.
Open this step in lesson mode · Link to this step · This confused me
7A /crew command and a team tag
Two chat features most games have: a command players type, and a tag beside a name. Beacon Yard has neither yet, so you build both as an extension of m14-ship.
A command is a TextChatCommand inside TextChatService. Its PrimaryAlias is what the player types, such as /crew. When someone sends it, the command's Triggered event fires with the sender's TextSource and the message, and a server script can answer12. The yard answers through its own Feedback remote, so the reply is a system line in the sender's window only, drawn the same way as Drill started.
-- src/server/CrewCommand.luau
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextChatService = game:GetService("TextChatService")
local CrewCommand = {}
function CrewCommand.start()
local command = TextChatService:WaitForChild("CrewCommand") :: TextChatCommand
command.Triggered:Connect(function(source: TextSource, _message: string)
local player = Players:GetPlayerByUserId(source.UserId)
local team = if player then player.Team else nil
local feedback = ReplicatedStorage:WaitForChild("Remotes"):FindFirstChild("Feedback")
if player == nil or team == nil or feedback == nil or not feedback:IsA("RemoteEvent") then
return
end
local count = #team:GetPlayers()
feedback:FireClient(player, "announce", `{count} on {team.Name} right now`)
end)
end
return CrewCommand
A tag is a client job. TextChatService.OnIncomingMessage is a callback each client sets once. Return a TextChatMessageProperties with a new PrefixText and the name is drawn with it. The callback must not yield, so it reads the speaker's Team, which every client already knows13.
-- inside ChatTags.start() in src/client/ChatTags.luau
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local source = message.TextSource
local player = if source then Players:GetPlayerByUserId(source.UserId) else nil
local team = if player then player.Team else nil
if team == nil then
return nil
end
local props = Instance.new("TextChatMessageProperties")
local hex = team.TeamColor.Color:ToHex()
props.PrefixText = `<font color="#{hex}">[{team.Name}]</font> {message.PrefixText}`
return props
end
Build along
default.project.jsonsrc/server/CrewCommand.luausrc/server/init.server.luausrc/client/ChatTags.luausrc/client/init.client.luau
In
default.project.json, add a child to theTextChatServiceentry:"CrewCommand": { "$className": "TextChatCommand", "$properties": { "PrimaryAlias": "/crew" } }.You should see After rojo serve syncs, Explorer shows CrewCommand, a TextChatCommand with PrimaryAlias /crew, under TextChatService.
Add
CrewCommand.luaufrom the first block, require it ininit.server.luauand callCrewCommand.start()right afterTeamService.start().You should see In a Server & Clients test with 2 clients, typing /crew shows 2 on Drillers right now as a system line in the sender's chat only; the other client sees nothing.
Add
ChatTags.luauwith astartfunction around the second block (plusGetServicelines forPlayersandTextChatService), and call it frominit.client.luau.You should see Ordinary messages from both players show a cyan [Drillers] before the name in both chat windows.
From May 2027 platform-integrated chat is required. Which of the two features you just built keeps working?
Answer
The /crew command; the [Drillers] tag stops showing. Platform-integrated chat keeps TextChatCommand and replaces the prefix system with roles Roblox renders. Build commands this way now, and treat a PrefixText tag as temporary.
Open this step in lesson mode · Link to this step · This confused me
8Where the controller picture breaks
Client sideRemember: The client is your screen and controller at home.
The client is your screen and controller at home. Controllers send requests; they do not move the real players. Except one: your own character. Answer first, then open the breakdown.
Where does it break?“Your screen and controller at home” is a good picture of the client. Where does it stop being true?
It breaks here. The client also simulates your own character's movement and sends it up, so it is more than a screen.
The true model. Each player's device runs its own copy of the game for display and input. It owns its character's physics by default, which is why movement feels instant and why a cheater can move strangely.
An exploiter skips the shop and runs this on their client. What happens?
local humanoid = game.Players.LocalPlayer.Character.Humanoid
humanoid.WalkSpeed = 24
Answer
Their character really runs at 24, and everyone sees it move faster. Each client simulates its own character and sends the movement up, so a local WalkSpeed change moves the real body. That is why speed boosts are sold on the server, and why serious games also check movement on the server.
Open this step in lesson mode · Link to this step · This confused me
9Build it: team and chat line
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Default TextChatService window | Roblox's chat window and bubbles, customised with properties and callbacks. | Almost every game, including Beacon Yard. | Your styling options are limited to what the service exposes. |
| TextChannelWindow | A chat window you place in your own UI, rendered by Roblox, for platform-integrated chat. | Games that want chat in a custom layout and are moving to platform-integrated chat. | Message text is not available to your code. |
| Custom chat UI on TextChatService | Your own UI that sends with TextChannel:SendAsync and reads incoming messages. | Games that needed full control before platform-integrated chat. | Being phased out: from May 2027 platform-integrated chat is required and these APIs return empty strings. |
Build along
src/server/TeamService.luausrc/server/AnnounceService.luausrc/client/SoundClient.luaudefault.project.json
In the game repo, run
git diff --stat m05-the-round m06-drone-wrench -- src/server/TeamService.luau src/server/AnnounceService.luau default.project.json.You should see TeamService.luau and AnnounceService.luau are new, and default.project.json gains a TextChatService entry with ChatVersion set to TextChatService.
Run
git diff m05-the-round m06-drone-wrench -- src/server/RoundService.luauand find the announce call.You should see RoundService calls AnnounceService.say inside pcall with the text Drill started when the round goes Active.
Build the place with
rojo build -o beacon-yard.rbxlx, open that file (a session opened before ChatVersion was set cannot switch it), then open the playtest dropdown and start Server & Clients with 2 clients.You should see Two windows open. Both player lists show the Drillers team in cyan with two players under it.
Start a drill from either client.
You should see Both clients' chat windows show Drill started as a system line.
Open this step in lesson mode · Link to this step · This confused me
10Challenges
Level 1, Apprentice
Challenge
Recolour the team and see where the colour appears, then put it back.
- Start from
- The game at milestone m06 (download)
Done means
- The Drillers row shows a different colour in the player list
- TeamColor is Cyan again afterwards
Hints
- TeamColor takes a BrickColor, such as BrickColor.new("Bright orange").
- It is set in TeamService.start.
Level 2, Builder
Challenge
Let players name the crate, safely and within the chat guidelines.
- Start from
- The game at milestone m06 (download)
Done means
- A client can send a name for the exhibit crate through a remote
- The server filters it with FilterStringAsync and GetNonChatStringForBroadcastAsync before showing it on a SurfaceGui
- A failed filter shows nothing, and each player can rename at most once a minute
Hints
- Add a remote name to Remotes.luau's list.
- Keep a table of the last rename time per player on the server.
- Wrap both filter calls in pcall.
Why should a game identify each player by player.UserId instead of player.Name or player.DisplayName?
Answer
A user can change their username or display name; UserId stays fixed to the account. Identifiers must not change. A renamed player would look like a brand-new account under the new name, and someone else who later claimed the old name would inherit their identity.
Level 3, Professional
Challenge
Add a Spectators team that nobody joins automatically.
- Start from
- The game at milestone m06 (download)
- Grade it
- To grade work from an earlier milestone, apply your challenge changes to a checkout based on
m14-ship, which includes the Course Runner. In Studio, press Play, then rungame.ServerScriptService.RunGameTests:Invoke("players-teams-chat", "players-spectators")in the server command bar. Copy the pass code from Output.
Done means
- A second Team named Spectators exists under Teams with AutoAssignable = false and TeamColor = BrickColor.new("Really red")
- Every current player stays on Drillers and carries a YardTeam attribute set to "Drillers"
- challenges/players-teams-chat.luau prints TEST PASS for spectators_team and yard_team
Hints
- Create Spectators in TeamService.start next to Drillers with AutoAssignable = false and TeamColor = BrickColor.new("Really red").
- Set the YardTeam attribute to "Drillers" in assign, where player.Team is set.
Open this step in lesson mode · Link to this step · This confused me
11Recap
Recap
- A Player joins first and its character spawns later; save by UserId, change the body on CharacterAdded, and put Team instances under the Teams service.
- Chat goes through TextChatService; system lines are drawn per client, and any player-written text others see is filtered on the server with FilterStringAsync and rate-limited.
- Roblox requires an age check before anyone can chat and groups users by age; check CanUserChatAsync, never route around TextChatService, and plan for platform-integrated chat in May 2027.
- A chat command is a TextChatCommand whose Triggered event runs on the server; a chat tag sets PrefixText in the client's OnIncomingMessage, and platform-integrated chat drops tags but keeps commands.
The client is your screen and controller at home, until the client also simulates your own character's movement and sends it up, so it is more than a screen.
Queued for review
Next Input everywhere, part 1: keyboard, gamepad, touch and accessibility
Open this step in lesson mode · Link to this step · This confused me