Example on Text and Chat Filtering doesn't actually filter text

This is a rather serious issue with this resourse. If players are new to chat filtering and they want to copy and paste the code to avoid creating their own (which I highly suspect has already been done lots), they’re copying and pasting something which puts their game at risk of moderation.

The page I’m referring to is this article on the Developer Hub. The specific example I’m referring to is the first one given, for sending private messages.

The problem is all down to the server script, on line 38. I’ve extracted the block of code and annotated it to highlight the problem:

local function onSendMessage(sender, recipient, message)
  if message ~= "" then
    -- Filter the incoming message and send the filtered message
    local messageObject = getTextObject(message, sender.UserId)
    
    if messageObject then
      local filteredMessage = getFilteredMessage(messageObject, recipient.UserId)
      sendMessageEvent:FireClient(recipient, sender, message) -- line 38
      -- Problem is here ^ message being sent instead of filteredMessage
    end
  end
end
 
sendMessageEvent.OnServerEvent:Connect(onSendMessage)

At first glance, it all looks fine, but looking more deeply at the example you’ll notice how it triggers a client event sending the originally recieved message instead of the filtered message.
All that needs to be changed is update message to filteredMessage.

When moderating games in the future, moderators should be mindful of this as the cause of the moderation may actually be down to Roblox themselves. uno reverse card
The example game on the is actually affected by this too!

13 Likes

Oh my!

Yes, I’ve tested this myself in the example game, thank you so much for telling us!

I was genuinely about to start working on my own custom chat system based on different server-based UIs, like SurfaceGui. I hope this is fixed immediately and does not cause developers to face harsh moderation.

I will be mindful of this moving forward.

Have you contacted any of the moderation on this? Have they given any statement on this?

3 Likes

I’ve passed this on to the Developer Hub documentation team and alerted the moderation team that this code could cause unintended improper text filtering. Thank you for bringing this to our attention!

4 Likes

Thank you so much!

I was pretty worried, it’s amazing how fast you guys came to reply!

Thanks again!

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