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.

Concept lesson, about 75 minutes, 11 steps

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

Step 1 of 11

Two 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
  1. 0:00 Team Test joins two players to one server.
  2. 0:04 Both land on the cyan Drillers team.
  3. 0:07 Player2 picks up a coin. Player1's list shows 35 become 40.
  4. 0:14 A drill tries to write a system line on RBXGeneral.
  5. 0:22 RBXGeneral exists here, so both chats show Drill started.
Choose one

Who "says" Drill started in the chat window?

Who "says" Drill started in the chat window?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 2 of 11

From 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 in order

Put a player's arrival in Beacon Yard in order.

  1. TeamService sets player.Team to Drillers
  2. The character spawns at the neutral Spawn
  3. player.CharacterAdded fires, and DataService sets WalkSpeed from the profile
  4. Players.PlayerAdded fires on the server

Link to this step · This confused me

Step 3 of 11

A 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.

Roblox Studio
Beacon Yard during Play with the player list open at the top right showing the Drillers team row and a player's coins, and the HUD at the top left.

Select a numbered pin, or a row below, to read what it marks.

The player list groups players under the Drillers team row.

Predict the output

A teammate refactors TeamService and parents the Team to Workspace instead. What does the player list show?

team.Parent = workspace
A teammate refactors TeamService and parents the Team to Workspace instead. What does the player list show?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 4 of 11

Chat 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)
Choose one

Why does AnnounceService not call DisplaySystemMessage on the server?

Why does AnnounceService not call DisplaySystemMessage on the server?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 5 of 11

Filter 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.
luau
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.

Find the broken line

This server code puts a player's crate name on a sign everyone can see. Which line breaks the rules?

This server code puts a player's crate name on a sign everyone can see. Which line breaks the rules?

Press 1 to 8 to choose, Enter to check.

Link to this step · This confused me

Step 6 of 11

Chat 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.

Choose all that apply

Which of these are true for a Roblox game today?

Which of these are true for a Roblox game today?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 7 of 11

A /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.

luau
-- 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.

luau
-- 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

m14-ship

  • default.project.json
  • src/server/CrewCommand.luau
  • src/server/init.server.luau
  • src/client/ChatTags.luau
  • src/client/init.client.luau
  1. In default.project.json, add a child to the TextChatService entry: "CrewCommand": { "$className": "TextChatCommand", "$properties": { "PrimaryAlias": "/crew" } }.

    You should see After rojo serve syncs, Explorer shows CrewCommand, a TextChatCommand with PrimaryAlias /crew, under TextChatService.

  2. Add CrewCommand.luau from the first block, require it in init.server.luau and call CrewCommand.start() right after TeamService.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.

  3. Add ChatTags.luau with a start function around the second block (plus GetService lines for Players and TextChatService), and call it from init.client.luau.

    You should see Ordinary messages from both players show a cyan [Drillers] before the name in both chat windows.

Choose one

From May 2027 platform-integrated chat is required. Which of the two features you just built keeps working?

From May 2027 platform-integrated chat is required. Which of the two features you just built keeps working?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 8 of 11

Where 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.

Predict the output

An exploiter skips the shop and runs this on their client. What happens?

local humanoid = game.Players.LocalPlayer.Character.Humanoid
humanoid.WalkSpeed = 24
An exploiter skips the shop and runs this on their client. What happens?

Press 1 to 4 to choose, Enter to check.

Link to this step · This confused me

Step 9 of 11

Build it: team and chat line

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Default TextChatService windowRoblox'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.
TextChannelWindowA 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 TextChatServiceYour 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.
  • src/server/TeamService.luau
  • src/server/AnnounceService.luau
  • src/client/SoundClient.luau
  • default.project.json
  1. 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.

  2. Run git diff m05-the-round m06-drone-wrench -- src/server/RoundService.luau and find the announce call.

    You should see RoundService calls AnnounceService.say inside pcall with the text Drill started when the round goes Active.

  3. 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.

  4. Start a drill from either client.

    You should see Both clients' chat windows show Drill started as a system line.

Link to this step · This confused me

Step 10 of 11

Challenges

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

Meet the criteria above, then record your own result. No test grades this check.

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

Meet the criteria above, then record your own result. No test grades this check.

Choose one

Why should a game identify each player by player.UserId instead of player.Name or player.DisplayName?

Why should a game identify each player by player.UserId instead of player.Name or player.DisplayName?

Press 1 to 4 to choose, Enter to check.

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 run game.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

The Course Runner prints this code when the test passes.

Link to this step · This confused me

Step 11 of 11

Recap

Recap

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Next Input everywhere, part 1: keyboard, gamepad, touch and accessibility

Link to this step · This confused me