Hayo!
EDIT 2:
Easiest way to fix this issue is to remove the forked chat scripts and update to the current scripts.
If you have other additions in your Chat scripts that you would prefer to not have to re-add, then the steps below will guide you to the solution.
I took another look at the issue and fixed the Event Folder error.
I was able to quickly fix the underlying cause of that error but in doing so brings up another issue. The ChatService attempts to send data to that speaker as if it was a player object, but it is not.
I’m currently trying out a variety of quick fixes for the issue and will edit this post with any updates if there are any.
EDIT:
The fix for the issue is quick as it doesn’t take much effort to change out.
I can neither confirm nor deny that this issue is fixed in up-to-date chat scripts, but this is a fix if it is not already.
Steps 1 through 3 are optional and are not required to fix the issue.
Steps 4 and above will fix the issue
Step 1:
Open the ChatService script in your forked copy of the Chat Scripts. (game.Chat.ChatServiceRunner.ChatService)
Step 2:
Search for the method AddSpeaker (CTRL + F on windows)
Step 3:
Replace the method with this below:
function methods:AddSpeaker(speakerName)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
self.Speakers[speakerName:lower()] = speaker
speaker.EventFolder = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents")
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
return speaker
end
The code above correctly adds an EventFolder to the new speaker, which was not done before.
Step 4:
Navigate to your Speaker module. Located in game.Chat.ChatServiceRunner.Speaker
Step 5:
Search for the method InternalSendMessage
Step 6: Select both the InternalSendMessage and InternalSendFilteredMessage and delete them
Step 7:
Replace the methods with the code below
function methods:InternalSendMessage(messageObj, channelName)
local success, err = pcall(function()
self:LazyFire("eReceivedUnfilteredMessage", messageObj, channelName)
if self.PlayerObj then
self.EventFolder.OnNewMessage:FireClient(self.PlayerObj, messageObj, channelName)
end
end)
if not success and err then
print("Error sending internal message: " ..err)
end
end
function methods:InternalSendFilteredMessage(messageObj, channelName)
local success, err = pcall(function()
self:LazyFire("eReceivedMessage", messageObj, channelName)
self:LazyFire("eMessageDoneFiltering", messageObj, channelName)
if self.PlayerObj then
self.EventFolder.OnMessageDoneFiltering:FireClient(self.PlayerObj, messageObj, channelName)
end
end)
if not success and err then
print("Error sending internal filtered message: " ..err)
end
end
The code above is checking whether a speaker has a player object or not, if it does not, there is no need to send it the updated message. On the other hand, if there is a player object in regard to a speaker, the filtered message will be sent to the correct player.
Thanks!