Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How Can I Filter Swear Words in this Custom Chat GUI That I Made?

Asked by
8391ice 91
8 years ago

I want to ensure that the game I make is as friendly as possible for people of all ages, and to do so I need to stop people from swearing in this custom chat GUI I made. I think what I would need to do is just create a table filled with all of the possible swear words someone could say and make some kind of function that automatically censors what someone says if it included one of those words, but how could I do that? I've looked all over the ROBLOX wiki for a function that scans through a string to find a word and I can't find one that does. How exactly could I make this happen?

The way my chat GUI works is a folder is in the Workspace and whenever someone chats, a StringValue is created with the name and message of that chatmessage and places in the folder. In a LocalScript inside the StarterGui, which is the one below, a function is triggered whenever a child is added to that folder, and then it'll spit out the message.

01local cb1 = script.Parent.cb1
02local cb2 = script.Parent.cb2
03local cb3 = script.Parent.cb3
04local cb4 = script.Parent.cb4
05local cb5 = script.Parent.cb5
06local cb6 = script.Parent.cb6
07local cb7 = script.Parent.cb7
08local cb8 = script.Parent.cb8
09badWords = {"censored", "bleep"} --In my actual script, there are bad words here, but I took them out. I'm sure it's obvious why :P How can I make it so that the script will scan a message to look for any words that are included here? If there is a way, I could make it so that the result is.. chat.Name.. ": [CENSORED]"
10 
11game.Workspace.ChatStorage.ChildAdded:connect(function(chat) --Whenever a new object is added to the ChatFolder in the workspace, this fires.
12    cb1.Text = cb2.Text -Basically, what this is doing is moving all of the texts up. There are 8 chatboxes.
13    cb2.Text = cb3.Text
14    cb3.Text = cb4.Text
15    cb4.Text = cb5.Text
View all 44 lines...

1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

ROBLOX has an official policy regarding this. This Wiki article gives an example of how to make custom GUI.

The important function to take advantage of is FilterStringAsync.

You shouldn't define your own filter (even if you dislike ROBLOX's) because your game will eventually be moderated if it doesn't meet the standards of ROBLOX's.

0
Oh geez I didn't know ROBLOX has a policy regarding this! Thank you so much! You just saved my game from getting banned, LOL! 8391ice 91 — 8y
Ad

Answer this question