#sending a server message in chat
1 messages · Page 1 of 1 (latest)
before making a post it's important to use google first
i have
i didnt really understand
i believe RBLXGeneral text channel has a function to display system messages
yep this
that helps more
let me try
only visible to that user in a local script right?
yes
you can hook this up to a remote event if you want it to be global
Ye, as Switch said.
yeah i thought so
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
you don't use it on text chat service
you do it on a channel or something
don't ask me what that is
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
'''
i just saw that
oops
i tried the first part
i don't think i can get lua embed on mobile
23:05:44.580 TextChannel:DisplaySystemMessage can only be called on the client. - Server - GlobalServerChat:5
yyour calling it on serve
but then if its client how can i show for everyone
do it on client
use a remote event
fire it to all clients
no
use one
fire a remote event with the message data
then run the system msg on client
two scripts one server one client
okay well in my case i will use a bindable
you can't
bendable can't communicate server and client
No
???
im tryna send a message in the chat by server
Oh
i said that
you said bindable
well i ment remote after but yes mb
oh okay
anyway let me try this
wait you don't need two
use one
client only sends to server
and server only sends to clients
there's no need for you to have 2
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.")
** You are now Level 6! **
There that should work
✅ Step-by-Step to Change Message Color (Client-Side Only)
- 📁 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).
chat gpt?
accident
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
Nope
and server event can send things to client
Because it does and I have the script for my game of working on because my friend worked on it
Did it work