0
\$\begingroup\$

So, I would like to add my own chat filter to my game, how would I do this?

eg: Player says: "DIE" Goes through chat filter and comes out as: "###" or any other string I specify.

\$\endgroup\$
  • \$\begingroup\$ How have you set up your chat so far? \$\endgroup\$ – DMGregory Dec 10 '18 at 0:43
  • \$\begingroup\$ I haven't done anything so far, I don't know where ro start. \$\endgroup\$ – W0LFB0MB Dec 10 '18 at 1:32
  • \$\begingroup\$ You should start by creating a Roblox game. You'll need to learn enough Lua scripting to modify the Lua Chat System. You'll be looking to add a Filter Function that replaces words in each message's content using string.gsub. Maybe this helps you get started? I would recommend for you to ask questions about the specific thing you're stuck at right now, so answers can get straight to the point. \$\endgroup\$ – Anko Dec 12 '18 at 12:45
  • \$\begingroup\$ @Anko that looks like it could make a pretty good answer, with just a little more detail about how to set up this filter function. \$\endgroup\$ – DMGregory Dec 13 '18 at 15:39
1
\$\begingroup\$

Some games have their own custom chat guis. You could create one, then have an event that would fire in the server when a player sends a message. Creating the gui is beyond the scope of this question, but the event could have some pseudocode like this:

if(string.match(message, "DIE")) then
    addMessageToGui("###")
else
    addMessageToGui(message)
end

For more resources on remote events, you can learn how to communicate between the client and server here:

https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.