How to send a server chat message from the server?

I am trying to find a way to send a chat message such as “[Server]: Hello world!” from the server. All solutions I’ve found are using RemoteEvents to fire the client, but are there any ways to send it from the server?

I’ve looked around on the dev forum but I haven’t really found anything. I hope someone has a solution to this!

3 Likes

I always refer to this post whenever I need to send things to chat. I believe it should help you out too!

1 Like

Assuming you’re using the new TextChatService, then no I don’t think there is a way since TextChannel:DisplaySystemMessage() can only be used on the Client. By the way, can I ask why you need the chat message to be sent from the server only?

If you are using a RemoteEvent to send a System Message, they typically come from the Server via RemoteEvent to the Client, The Chatting part of the Player’s Chat is Handled on the Client, and if you need to send it to all Players, use :FireAllClients() to send the Message from the Server to All Clients, it works the exact same way for the Legacy Chat, and TextChatService.

So in this sense: you are Sending a Message from the Server, the Client would just be recieving it and Displaying it to all Clients, or a Specific Client.

Oh okay!
I am currently trying to see how much of a game I can make with 1 single line of code, a silly but very interesting project. That’s why I was wondering about the chat messages from the server.

I see, sounds interesting but yes as @DasKairo mentioned, displayed messages are handled by the client.

Make a script in server script service that fire a remote event for all clients every time you want it to send a message. Then go to StarterPlayerScripts and insert a local script. The script:

Local StarterGui = game:GetService(“StarterGui”)
Local ReplicatedStorage = game:GetService(“ReplicatedStorage”)

Local remoteEvent = ReplicatedStorage.[Your Remote Event Name]

remoteEvent.OnClientEvent:Connect(function(message)

    StarterGui:SetCore("ServerMakeMessage", {
       Text = "[SERVER]: "..message,
    })

end)

Just so you know, I don’t remember most of the script, so it might be incorrect!

edit : it was

remoteEvent.OnClientEvent:Connect(function(message)
StarterGui:SetCore(“ChatMakeSystemMessage”, {
Text = "[SERVER]: " … message
})
end)

3 Likes