Chat interception

How would i make a script where if someone says the word, say, “banana” it replaces the word with “[deleted]” and sends the message so “i love banana” would be “i love [deleted]”?

This explanation might get a little hacky, but is entirely possible.

Let’s start with the question: What is the chat Gui, and how does it work?

Note: This is only possible on the client-side, replicating this would require server-side access.

Well really its just managed by premade CoreScripts, But its not protected; which means we can change anything about the chat frame, as long as it is on the client.

We need to modify this on the client, Everyone’s Client
This involves copying a localscript to everyones player, that will do a simple find and replace to the chat object.

Well… where is the GUI object?
I did some looking around and it actually clones to everyones Player.PlayerGui.
image
Where each one of these frames is simply a message that is sent, I tried changing the .Text of the textlabel and it worked.

Initial Untouched Message:
image
After Modification:
image
So, It’s perfectly viable to do this; All you need is to use some string replacement functions to accomplish the original task.

local ChatLabel = path.to.ChatLabel 

--// Phrase is present.
local phrase = "banana"
if ( string.find(phrase, ChatLabel.Text) ) then
    string.gsub(ChatLabel.Text, phrase, "[DELETED]")
end

I wont really go into replicating to every client, but here is a rough explanation:

  1. Make a localscript that changes this phrase, that can be controlled to change phrases with remote events
  2. Disable the localscript
  3. Loop through all the players in the game constantly if the script is not present, clone the localscript to the players Player.PlayerScripts and enable execution.
1 Like

y‌‌‌‌‌ou ar‌‌‌‌‌‌e in‌‌‌‌‌s‌‌‌an‌‌‌‌e

1 Like