local ChatService = game:GetService("Chat")
local function relay(messageObj)
print("relay function called") --> actually prints when I chat
return messageObj
end
ChatService:RegisterChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, relay)
However, when I switch to the TextChatService ChatVersion, it never prints when I chat.
Using the docs I found this above but that only made my problem worse. Is there a way it won’t be on the client? How am I supposed to do custom filtering without forking chat or relying on a client?
These also don’t work. Unsure if I’m using them wrong but they literally do nothing.
game:GetService("TextChatService").SendingMessage:Connect(function(pleasePrintSomething)
print(pleasePrintSomething) --> does nothing
print("test") --> does nothing
end)
game:GetService("TextChatService").MessageReceived:Connect(function(pleasePrintSomething)
print(pleasePrintSomething) --> does nothing
print("test") --> does nothing
end)
local TextChatService = game:GetService("TextChatService")
local generalChannel : TextChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
generalChannel.ShouldDeliverCallback = function(textChatMessage: TextChatMessage, targetTextSource: TextSource)
print"g" --> prints
return false --> false = client still sees it but other players don't, true = sends like normal
end
Reminder: If you have concerns about filtering, don’t worry! The message returned by the OnIncomingMessage callback is received as filtered. Therefore, you don’t need to filter the string one more time, with an exception. If you modify the message under OnIncomingMessage and push some profanity words into it, it will NOT be filtered as it will take place in the chat after the callback (the player that writes the message will be affected, but I’m unsure about other clients).
local TextChatService = game:GetService("TextChatService")
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local TextChatMessageProperties = Instance.new("TextChatMessageProperties")
TextChatMessageProperties.Text = message.Text .. "PROFANITY" -- Suppose the second string was profanity
return TextChatMessageProperties -- Reason to be banned
end