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: find a string

Previous Thread :: Next Thread 
sunday1520 is not online. sunday1520
Joined: 23 Aug 2012
Total Posts: 693
18 Feb 2014 10:27 AM
Is it possible to use "findFirstChild" to find anything that starts with sword? Like for example within this frame, there could be "swordiron" or "swordsteel", so if either of them is there, i dont care which, it will continue on with code. I tried string.sub but as far as i know you need a string, and i dont know what the full string would be.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
18 Feb 2014 10:30 AM
you would use

if string.sub(lol.Name, 1, 5) == "sword" then


end

Report Abuse
sunday1520 is not online. sunday1520
Joined: 23 Aug 2012
Total Posts: 693
18 Feb 2014 10:31 AM
whats lol though? how do i define that?
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
18 Feb 2014 10:33 AM
for _, lol in pairs(script.Parent:GetChildren()) do --get every child of script's parent
if string.sub(lol.Name, 1, 5) == "sword" then --filter the children out by name
print'Name starts with Sword'
end
end
Report Abuse
sunday1520 is not online. sunday1520
Joined: 23 Aug 2012
Total Posts: 693
18 Feb 2014 10:36 AM
Okay sweet, thanks
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