I’m following the documentation from here and it says that there should be a message property in the ChatMessage object, but after when I looped through all the properties of said object, no property was named Message. How would I get the message’s content if I can’t find where the message property is? This is my code at the current moment
require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")):GetChannel(_G.adminConfiguration.channelName).MessagePosted:Connect(function(messageObject)
for i,v in pairs(messageObject) do
print("Index: " .. tostring(i) .. "\nValue: " .. tostring(v) .. "\n")
end
end)
Please stop bumping your thread. The DevForum rules have a provision against bumping threads.
MessagePosted is a little strange. If you dig into the ChatChannel code, you’ll find that the Message index is actually removed from the MessageObject after it invokes the OnServerReceivingMessage chat callback before being passed around in code.
You will have to resolve this by forking or finding another way to execute your system. In terms of forking, you will need to fork ChatServiceRunner and then modify ChatChannel. You can either stop the message from being removed (might be dangerous) or substitute the message back in:
local success, err = pcall(function()
messageObj.Message = message
self.eMessagePosted:Fire(messageObj)
end)
In terms of other methods, try seeing if working with the ChatSpeaker instead would work.
You still shouldn’t be bumping threads either way.
MessagePosted, despite its strange behaviour, still does exactly as intended: it’s a signal meant to fire when a message is posted to the current channel containing a ChatMessage object holding data for the sent message. My best assumption here is that there was a small oversight that was not touched on.