When using TextChannel:DisplaySystemMessage() (DSM), the message rarely starts inserting them at the wrong places.
This is the code I am using:
local displaymessage = remotes.UI.DisplayMessage
-- happens with both RBXGeneral and RBXSystem
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXSystem
displaymessage.OnClientEvent:Connect(function(message)
generalChannel:DisplaySystemMessage(message)
end)
After a certain period of time (seems to be linked to amount of messages sent), DSM starts putting the messages BEFORE other chat messages that were already in the chat window.
Other notes: The normal chat window messages go through TextChatService.OnChatWindowAdded() in order to apply colored text, however the issue of chronological order only happens with DSM after many text messages are sent.
This happens both in studio and in game.
The text messages should be sent at the bottom of the window like this:
REPRO FILE: Click the “send server message” button to see how the message is supposed to look like. Clicking the “instant max text” button instantly sends 48 messages using DisplaySystemMessage, which is around the amount of messages i’ve tested for the bug to happen. Then, click the “send server message” button to display multiple different lines, and they should be in the wrong positions. textchatservice bug repro.rbxl (73.6 KB)
yeah i also noticed that sometimes, TextChatService messages (system or not) will just not appear in the chat window at all (i couldnt report it since i didnt know how to prove it)
but this may be a may better explanation of whats happening instead of the messages just not appearing lol
Any update on this? It’s been a month and it doesn’t seem to be fixed yet. I found another issue as well, and that’s if you use the method to color nametags and use /whisper, the [From: player] no longer appears.
Normally LayoutOrder of the chat entries is properly counted, but after rapid use, multiple messages start sharing the same LayoutOrder property which breaks the layout.
it does seem to be related to sending multiple messages at the same time. i tested using a simple queue and task.wait() delay, which seemingly fixed the layout order even after multiple 48-line messages. i’ll use this method for now, hopefully it still works a week from now lol
might be a slightly different issue since i’m using displaysystemmessage, but heres my code if you want to verify:
local TextChatService = game:GetService("TextChatService")
local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral
local messagecache = {}
displaymessage.OnClientEvent:Connect(function(message, messagetype)
if not messagetype then
local t = tick()
table.insert(messagecache, t)
while messagecache[1] ~= t do
task.wait()
end
task.wait()
generalChannel:DisplaySystemMessage(message)
table.remove(messagecache, 1)
end
end)
displaymessage is the remote event from the server
I’m not sure if this is a long term fix, but I fixed it by putting the messages in a queue and then releasing them as a single message every 0.1s.
Here’s my code:
local msgQueue = {}
s2c:WaitForChild("msg").OnClientEvent:Connect(function(msg: string)
table.insert(msgQueue, msg)
end)
task.spawn(function()
local channel: TextChannel = TCS:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
while wait(0.1) do
local queue = msgQueue
if #queue == 0 then
continue
end
msgQueue = {}
channel:DisplaySystemMessage(table.concat(queue, "\n"))
end
end)
(Tho don’t close this report if this helps. I think Roblox should still address this)