How can I make a Chat System Message with TextChatService?

Hello, I have a problem, I can not make a system message with the TextChatService. Could you help me? Thank you. Here’s my code:

local event = game.ReplicatedStorage.plrjoined

event.OnClientEvent:Connect(function(plr)
game:GetService("TextChatService"):SetAttribute("ChatMakeSystemMessage", {
Text = "Welcome, "..plr;
Font = Enum.Font.SourceSansBold;
TextSize = 17
Color = Color3.new(0, 0, 1)
})
end)
1 Like

Maybe you should try to Set a different way for the Player variable.

Change it to your liking.

local event = game.ReplicatedStorage.plrjoined

event.OnClientEvent:Connect(function(plr)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
		Text = "[SYSTEM] welcome "..plr,
		Color = Color3.fromRGB(255 , 0 , 0),
		Font = Enum.Font.Arial,
		FontSize = Enum.FontSize.Size24
	})
end)

If you want to filter the text (in case you didn’t know what the message is)

local TextService = game:GetService("TextService")
local filteredTextResult = TextService:FilterStringAsync(text, userId)

Since you’re using TextChatService, you’ll need to utalize the DisplaySystemMessage function

game.TextChatService.TextChannels.RBXGeneral:DisplaySystemMessage("This is a message!", "SystemMessage")

3 Likes