generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to filter a string.

Previous Thread :: Next Thread 
Fresh_Effect is not online. Fresh_Effect
Joined: 05 Feb 2012
Total Posts: 1342
28 Dec 2016 07:02 PM
I just want a string to be checked for anything bad so roblox doesn't cite my custom chat gui. Is there a simple way to do this so I don't have to write out every bad word in the dictionary? Thanks
Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
28 Dec 2016 07:05 PM
http://wiki.roblox.com/index.php?title=API:Class/Chat/FilterStringForBroadcast #### slices of pizza and counting
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
28 Dec 2016 07:07 PM
No, this is the one you want:

http://wiki.roblox.com/index.php?title=API:Class/Chat/FilterStringAsync


Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
28 Dec 2016 07:07 PM
FilterStringAsync as well


Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
28 Dec 2016 07:08 PM
:/


Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
28 Dec 2016 07:08 PM
Wouldn't FilterStringAsync be for chat specifically? Or would you make up some BS for the third argument?


585,062 slices of pizza and counting
Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
28 Dec 2016 07:09 PM
nvm read the full thing now e.e

Use FilterStringAsync


585,102 slices of pizza and counting
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
28 Dec 2016 07:09 PM
He says in his post that this is for a chat gui.


Report Abuse
Fresh_Effect is not online. Fresh_Effect
Joined: 05 Feb 2012
Total Posts: 1342
28 Dec 2016 07:10 PM
I don't understand something until I can see an example. Would anyone be able to show me how I actually use this function?
Report Abuse
Pejorem is not online. Pejorem
Joined: 10 Apr 2012
Total Posts: 637
28 Dec 2016 07:10 PM
I seriously need to rethink my life.


585,102 slices of pizza and counting
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
28 Dec 2016 07:11 PM
http://wiki.roblox.com/index.php?title=Custom_chat_GUI


Report Abuse
Fresh_Effect is not online. Fresh_Effect
Joined: 05 Feb 2012
Total Posts: 1342
28 Dec 2016 07:12 PM
@Dillusions

I used that tutorial and still managed to drop and f-bomb in the chat
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
28 Dec 2016 07:12 PM
local chatService = game:GetService("ChatService")

for i,v in pairs(game.Players:GetPlayers()) do
local filteredMessage = chatService:FilterStringAsync(originalMessage, fromPlayer, v)
sendMessageToPlayer(v, filteredMessage)
end


Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
28 Dec 2016 07:12 PM
were you in studio?


Report Abuse
Fresh_Effect is not online. Fresh_Effect
Joined: 05 Feb 2012
Total Posts: 1342
28 Dec 2016 07:17 PM
@foreverpower

studio underlined "ChatService"
Report Abuse
Disillusions is not online. Disillusions
Joined: 10 Jul 2011
Total Posts: 6365
28 Dec 2016 07:18 PM
@Fresh

FilterAsync doesn't work in studio

that chat tutorial doesn't filter the string for yourself, only for others


Report Abuse
Fresh_Effect is not online. Fresh_Effect
Joined: 05 Feb 2012
Total Posts: 1342
28 Dec 2016 07:19 PM
@Dillusions

Oh, that makes sense. Thanks.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
28 Dec 2016 08:14 PM
here is the most basic example of filtering

local filtered = {'noob','lame','lol'}

local msg = 'hi noobs you are all lame people lol'

local Filter = function(msg)
local s = msg
for i,v in next, filtered do
for m in msg:gmatch(v) do
s = s:gsub(m,string.rep('#',#m))
end
end
return s
end

print(Filter(msg))

>>hi ####s you are all #### people ###


Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
28 Dec 2016 08:16 PM
^

Not really what he was asking for.


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
28 Dec 2016 08:18 PM
yes i dont care what he was asking for because filterstring is awful.


Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
28 Dec 2016 08:22 PM
It is, but Roblox will potentially ban games for not using it.


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image