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 » Scripting Helpers
Home Search
 

Re: could someone explain string.match to me?

Previous Thread :: Next Thread 
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
08 Mar 2014 07:15 PM
well,i checked on wiki,and its hard to understand..
I simply want to check,for example if someone said
ex:
person says:
tgjkfghiPizzajg
it finds that the word "Pizza" was in the string,so it prints "he said pizza"
or something like that
another example:
person says
hello world,whats new?

it finds that he said the word "world"

how would I go about doing this??
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 Mar 2014 07:17 PM
local message = "wsajdvnbkfdecPizzadfcwa"

local foundItem = string.match(message, "Pizza")
if foundItem ~= nil then
print "He said pizza!"
end
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
08 Mar 2014 07:17 PM
wow..i feel stupid..
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 Mar 2014 07:19 PM
lol :P

Just wait till you try to learn patterns. They're insanely easy and insanely difficult at the same time. >_<
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
08 Mar 2014 07:19 PM
so,would this be correct?

game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(m)
if p.Name == "islandmaker2012" then
s = string.match(m,"Show")
s2 = string.match(m,"Accs")
if s or s2 then
Workspace.GetAccs.Value = true
end
end
end)
end)
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
08 Mar 2014 07:21 PM
Yup.
If you say Show, it will work.
If you say Accs, it will work.
If you say Showing, it will work.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
08 Mar 2014 07:22 PM
thx for ur help!:D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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