TextChatService:SendSystemMessage does not work

Hello,
Im testing the new TextChatService for a further project on Server messages.
I saw a post that indicated that this code would work in order to send a message:

Script in ServerScriptService:

local rS = game:GetService("ReplicatedStorage")
local messageScript = game.TextChatService:FindFirstChild("RBXGeneral")	

		
rS.SendMessage.OnServerEvent:Connect(function(p)
	messageScript:SendSystemMessage('<font color=\"rgb(255, 0, 0)\">Server message test.</font>') 
end)

(Roblox chat seems to use html)

The thing is, every time I FireServer, the output gives this error:

Does anyone know how to fix that in order to print a message in the Roblox global chat?

1 Like

Maybe instead of FindFirstChild do WaitForChild

1 Like

game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage("message")
hope this helped

I already tried that, ends up as infinite yield

1 Like

idk why you deleted your message but if this is the way ur doing it then this should work

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextChatService = game:GetService("TextChatService")

ReplicatedStorage.SendMessage.OnServerEvent:Connect(function(player: Player)
	local channel = TextChatService.TextChannels.RBXGeneral
	channel:DisplaySystemMessage("message for " .. player.Name)
end)

i deleted it cause i sent a ss of an error that was mf lol

the thing is that i did a button gui that when you click it, it Invokes Server to a RemoteFunction inside of Replicted Storage. (Button LocalScript:)

script.Parent.MouseButton1Click:Connect(function()
	local rE = game:GetService("ReplicatedStorage").SendMessage
	rE:InvokeServer()
end)

ReplicatedStorage.SendMessage is a RemoteFunction (do i use RemoteFunction, RemoteEvent, BindableFunction or BindableEvent, Also, i wanna print a certain message which will be inside of that script)

Then I have a server script inside ServerScriptService that sends the message to the RBXGeneral text chat. I have several issues when it comes to using InvokeServer and/or InvokeClient and/or FireServer, etc. Idk what to use in each case although I already read the roblox docs several times. So i’m pretty confused on that and I really need help cause I’ve been 2 days trying to make this work LOL

so are you using a RemoteEvent or RemoteFunction? RemoteEvents are more for procedures and remotefunctions are more for functions (they return something)

i think you should use a RemoteEvent since there’s no info you need to gain in return

:FireServer() is for RemoteEvents

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.