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: Filtering a word out of a text.

Previous Thread :: Next Thread 
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
11 Oct 2016 10:14 AM
Hello, I need help with scripting because
How do you filter a word out of a text?

For example: The Noob says "hello.".

How do I filter "The Noob"
And replace it with a player name for example?

I need help with this and would be very happy if I know how this works.

Thank you.
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
11 Oct 2016 10:26 AM
http://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation#string.match
http://wiki.roblox.com/index.php?title=String_pattern
Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
11 Oct 2016 12:46 PM
I want a example of a script that filters "The Noob says hello!" And filters "The Noob" out of the text and replaces it with "Player" so please give me a example instead of telling me to go to roblox wiki.
Report Abuse
gskw is not online. gskw
Joined: 05 Jan 2013
Total Posts: 1364
11 Oct 2016 12:48 PM
local NewString = OriginalString:gsub(StringToFind, StringToReplaceWith)
Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
12 Oct 2016 07:13 AM
Does the also work when the word is in upper and lowercase letters with numbers in it?
Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
12 Oct 2016 07:15 AM
Can you do it with output or something like that? It's hard to understand.
Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
12 Oct 2016 09:30 AM
If you filter a word out of a text, how do you replace a word in a text then?
Report Abuse
batistapowerbonbtla is not online. batistapowerbonbtla
Joined: 16 Dec 2011
Total Posts: 2203
12 Oct 2016 09:44 AM
Give up

https://www.roblox.com/library/499105467/Hillary
Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 09:49 AM
If you don't understand what they have already said, I think you should go back to using free models
Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 09:52 AM
you should also use the wiki

local string = "Hello Noob!"
string = string:gsub("Noob", "Player")

print(string)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
12 Oct 2016 10:21 AM
#############################################################################################################################################################################################################################################################################################################################################################################################
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
12 Oct 2016 10:24 AM
pastebin
.
com
/DpFfBddV


Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
12 Oct 2016 11:19 AM
ok thanks but can you also make it filter a word even if it is typed like this. "NoOb"?
Does this also work? would it be "%w(noob)" or "%wnoob%w"?
help me please.





Ps I am not gonna use free models, they are Rubbush sometimes and are not how i want them to be so I rather make my own models.
Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 11:24 AM
local Filter = {"noob"}
function filter(s)
for _, v in pairs (Filter) do
if string.find(string.lower(s), string.lower(v)) then
local repl = string.sub(s, string.find(string.lower(s), string.lower(v)))
if string.lower(repl) == string.lower(v) then
s = s:gsub(repl, string.rep(filterReplacement, #repl))
end
end
end
return s
end
print(filter("Hello NoOb!")


Report Abuse
RubyEpicDragon is not online. RubyEpicDragon
Joined: 02 May 2015
Total Posts: 1211
12 Oct 2016 11:25 AM
Ok, I finally Understand the GSUB thing.
but can you also replace a word without the gsub will put a number at the end?
and what if the word is typed like "NoOb" how do you filter "noob" out of that?
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
12 Oct 2016 11:26 AM
http://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation#string.lower
Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 11:26 AM
print(filter("Hello NoOb!"))


Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 11:31 AM
oh wait, this should do it

local Filter = {"noob"}
local filterReplacement= "#"
function filter(s)
for _, v in pairs (Filter) do
if string.find(string.lower(s), string.lower(v)) then
local repl = string.sub(s, string.find(string.lower(s), string.lower(v)))
if string.lower(repl) == string.lower(v) then
s = s:gsub(repl, string.rep(filterReplacement, #repl))
end
end
end
return s
end
print(filter("Hello NoOb!"))




Report Abuse
BlueSanik is not online. BlueSanik
Joined: 01 Dec 2011
Total Posts: 180
12 Oct 2016 11:39 AM
If you want it to replace noob to a player name, just change 'string.rep(filterReplacement, #repl)'to the players name


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