#sending a server message in chat

1 messages · Page 1 of 1 (latest)

gray scarab
#

how do i do this?

snow flint
gray scarab
#

i didnt really understand

snow flint
#

i believe RBLXGeneral text channel has a function to display system messages

gray scarab
#

only visible to that user in a local script right?

snow flint
#

you can hook this up to a remote event if you want it to be global

azure glen
#

Ye, as Switch said.

gray scarab
#
local TextChatService = game:GetService("TextChatService")

local textChatMessage = TextChatService:DisplaySystemMessage("🟢 Welcome to the game!", "WelcomeMessage")

if textChatMessage.Status ~= Enum.TextChatMessageStatus.Success then
    warn("Failed to send system message:", textChatMessage.Status)
end
#

23:03:24.180 DisplaySystemMessage is not a valid member of TextChatService "TextChatService" - Server - GlobalServerChat:3

snow flint
#

i think your doing it wrong

#

let me read the docs

snow flint
#

you do it on a channel or something

#

don't ask me what that is

gray scarab
snow flint
# gray scarab how

code from roblox docs
'''lua
local TextChatService = game:GetService("TextChatService")

local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral

generalChannel:DisplaySystemMessage("This is an error!", "Game.Error.Generic")
generalChannel:DisplaySystemMessage("Could not find save data!", "Game.Error.SaveDataNotFound")

generalChannel:DisplaySystemMessage("You won the game!", "Game.Info.Win")
generalChannel:DisplaySystemMessage("You lost the game!", "Game.Info.Lose")

generalChannel.OnIncomingMessage = function(message: TextChatMessage)
if string.find(message.Metadata, "Error") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(255, 0, 0)
return overrideProperties
elseif string.find(message.Metadata, "Info") then
local overrideProperties = Instance.new("TextChatMessageProperties")
overrideProperties.TextColor = Color3.fromRGB(0, 255, 150)
return overrideProperties
end

return nil

end
'''

gray scarab
#

i just saw that

snow flint
#

oops

gray scarab
#

i tried the first part

snow flint
#

i don't think i can get lua embed on mobile

gray scarab
#

23:05:44.580 TextChannel:DisplaySystemMessage can only be called on the client. - Server - GlobalServerChat:5

snow flint
gray scarab
#

but then if its client how can i show for everyone

snow flint
#

do it on client

snow flint
#

fire it to all clients

gray scarab
#

ahh

#

so use two?

snow flint
#

no

#

use one

#

fire a remote event with the message data

#

then run the system msg on client

#

two scripts one server one client

gray scarab
#

okay well in my case i will use a bindable

snow flint
gray scarab
#

wait no

#

i need two

snow flint
#

bendable can't communicate server and client

gray scarab
#

bc im sending from client

#

so i use 2

snow flint
#

No

gray scarab
#

client -> server -> all clients

#

two?

rain torrent
#

???

gray scarab
snow flint
#

what

rain torrent
#

Oh

snow flint
#

if the messages are from client

#

use two REMOTES

gray scarab
#

i said that

snow flint
#

you said bindable

gray scarab
snow flint
#

oh okay

gray scarab
#

anyway let me try this

snow flint
#

use one

#

client only sends to server

#

and server only sends to clients

#

there's no need for you to have 2

gray scarab
#

how

#

your just explained two

rain torrent
#

local TextChatService = game:GetService("TextChatService")

-- Wait for chat to be ready
TextChatService.OnIncomingMessage = function(message)
return true
end

-- Function to send a system message
local function sendSystemMessage(text)
local message = Instance.new("TextChatMessage")
message.Text = text
message.TextChannel = TextChatService:FindFirstChild("TextChannel_Main") or TextChatService:WaitForChild("TextChannel_Main")
message.PrefixText = "[Server]" -- Optional
message.Status = Enum.TextChatMessageStatus.Success

TextChatService:DisplaySystemMessage(message.TextChannel, message.Text)

end

-- Example usage
sendSystemMessage("Welcome to the game! Server says hi.")

prime pewterBOT
#

studio** You are now Level 6! **studio

rain torrent
#

There that should work

gray scarab
#

well i got it working anyway sorry

#

but one question

#

how do i change the color

rain torrent
#

✅ Step-by-Step to Change Message Color (Client-Side Only)

  1. 📁 Create a LocalScript inside StarterPlayerScripts:
    lua
    Copy
    Edit
    local TextChatService = game:GetService("TextChatService")

TextChatService.OnIncomingMessage = function(message)
local properties = Instance.new("TextChatMessageProperties")

-- Check if it's a system message
if message.TextSource == nil then
    properties.PrefixText = "[Server]"
    properties.Text = message.Text
    properties.TextColor3 = Color3.fromRGB(255, 100, 100) -- 🔴 Change to any color you want
end

return properties

end
🎨 Change Color Here:
lua
Copy
Edit
properties.TextColor3 = Color3.fromRGB(255, 100, 100)
Use any RGB color value you like!

✅ Now, on the Server Side (in ServerScriptService):
You can still send messages like this:

lua
Copy
Edit
local TextChatService = game:GetService("TextChatService")
local channel = TextChatService:WaitForChild("TextChannel_Main")

channel:DisplaySystemMessage("This is a custom-colored message.")
The LocalScript will intercept and recolor the message when it's displayed.

⚠️ NOTES:
This method only changes appearance on the client (so each player could have different styles if you want).

You can’t color text per-word or use rich formatting like <font color> in new chat system.

This only works with TextChatService (new chat system).

gray scarab
#

chat gpt?

snow flint
#

i just realized that you only need one

#

it's hard to wrap your head around

#

but if u think about it

#

client event is for events from server

rain torrent
#

Nope

snow flint
#

and server event can send things to client

rain torrent
#

Oh just me

#

prove it then

gray scarab
rain torrent
#

Because it does and I have the script for my game of working on because my friend worked on it

gray scarab
#

lol its fine

#

thanks for the help

#

let me try it

#

got it thanks

rain torrent
#

Did it work

gray scarab
#

i used my own way