Recently (18 days ago), Roblox locked all access to the previous chat version (LegacyChatService)
First off, I will say that I understand that adapting to this new change can be challenging, but the benefits of the TextChatService (TCS) far outweigh any difficulties you may be experiencing. TCS is a significant improvement over the LegacyChatService (LCS). To facilitate a smooth transition, I’m sharing some code snippets that you’ll recognise, now tailored for the new chat service. I’m confident these resources will make the process easier for everyone!
TextChatService enhances our chatting experience and helps keep younger players (who are often our troublemakers😂) safe on the platform, creating a more secure environment for everyone.
– TUTORIAL STARTS HERE –
Since Roblox restricted access to the old chat version, many functions have changed, including the function to send system messages.
It used to be done like this:
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "Welcome to my Christian Minecraft Server!",
Color = Color3.new(1, 1, 1), -- white text
Font = Enum.Font.SourceSansBold,
FontSize = Enum.FontSize.Size24
})
Which now translates to this:
local Message = "Welcome to my Christian Minecraft Server!"
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(Message)
If I left anything out or made any mistakes, please let me know.
How to make Channels
local Players = game.Players
local TextChannelService = game:GetService("TextChatService")
local CTC = TextChannelService:WaitForChild("ChannelTabsConfiguration")
local textChannels = TextChannelService:WaitForChild("TextChannels")
CTC.Enabled = true
local newTextChannel = Instance.new("TextChannel")
newTextChannel.Name = "NewTextChannel"
newTextChannel.Parent = textChannels
How to add Players to channels
To add a certain player to a channel, you have to use this function:
newTextChannel:AddUserAsync(player.UserId)
Or if you want to add any player who joins, you can use this function:
Players.PlayerAdded:Connect(function(player: Player)
newTextChannel:AddUserAsync(player.UserId)
end)
To add someone to a channel if they have a certain rank in a group. You would use this function:
Players.PlayerAdded:Connect(function(player: Player)
Players.PlayerAdded:Connect(function(player: Player)
local lowestrank = 254
local plrrank = player:GetRankInGroup(0)
if plrrank >= lowestrank then
newTextChannel:AddUserAsync(player.UserId)
end
end)
end)
Or if you want people in a certain group to access the channel, you can use this function:
Players.PlayerAdded:Connect(function(player: Player)
local GroupID = 0
local plrIsInGroup = player:IsInGroup(GroupID)
if plrIsInGroup then
newTextChannel:AddUserAsync(player.UserId)
end
end)
How to send messages to players
To send messages to players through the server, you would have to follow these instructions:
- Make a RemoteEvent and name it whatever you desire, “ServerToClient” in my example.
- Make a server script and paste the code below into the script.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SendChatMessage = ReplicatedStorage:FindFirstChild("ServerToClient")
function SendMessage(player, Message)
SendChatMessage:FireClient(player, Message)
end
- Now, make a Local Script in StarterGUI or StarterPlayer and paste the code below into that script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage:WaitForChild("ServerToClient").OnClientEvent:Connect(function(message)
game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage(message)
end)
- Now you can give your SendMessage function a reason to be there. Paste this under your SendMessage Function in your Server Script!
Players.PlayerAdded:Connect(function(player: Player)
local message = "Welcome to " ..game.Name.. "!"
SendMessage(player, message)
end)
How to make Chat Tags
You can use this video by @Blufinityy to make a chat tag system:
How To Create CHAT TAGS With TextChatService (Roblox Studio)
I recommend using the full tutorial, but for lazy people like me, here is the full script:
local textChatService = game:GetService("TextChatService")
textChatService.OnIncomingMessage = function(message: TextChatMessage)
local properties = Instance.new("TextChatMessageProperties")
if message.TextSource then
local player = game:GetService("Players"):GetPlayerByUserId(message.TextSource.UserId)
if player.Name == "HashtagBlu_YT" then --EDIT NAME HERE
properties.PrefixText = "<font color='#00ffee'>[Developer]</font> " .. "<font color='#ff8400'>[W Rizz]</font> " .. message.PrefixText -- EDIT HTML HERE
end
end
return properties
end
How to make Commands
- Add a TextChatCommand in TextChatService and name it
SizeCommand
- Change the
PrimaryAlias
value to/grow
and theSecondaryAlias
value to/shrink
- Insert a Server Script into ServerScriptService and name it “CommandHandler”
- Paste the script below into the
CommandHandler
Script:
local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
local sizeCommand: TextChatCommand = TextChatService:WaitForChild("SizeCommand")
sizeCommand.Triggered:Connect(function(textSource, message)
local scaleMult = 1
local messageWords = string.split(message, " ")
if messageWords[1] == "/grow" then
scaleMult = 2
elseif messageWords[1] == "/shrink" then
scaleMult = 0.5
end
local player = Players:GetPlayerByUserId(textSource.UserId)
if player then
local character = player.Character
if character then
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
for _, child in humanoid:GetChildren() do
if child:IsA("NumberValue") then
child.Value *= scaleMult
end
end
end
end
end
end)
Thank you so much for taking the time to read through my post! If you found it helpful, I’d love to hear your thoughts—feel free to like or reply to share your feedback, especially since this is my first big informative post. Your support means a lot!
I did put a lot of work into this, and it would be nice to see who I helped!