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: Why doesn't this string match for loop work?

Previous Thread :: Next Thread 
breakbroke9 is not online. breakbroke9
Joined: 05 Dec 2014
Total Posts: 51
11 Jul 2016 09:40 AM
local wArray = game.Workspace:GetChildren();

for i = 1, #wArray do
local item = wArray[i];
if string.starts(item.Name, "Part") then
print(item.Name);
end
end

It won't print anything in console. I'm trying to check whether certain parts start with "Part" and printing out their full names.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
11 Jul 2016 09:45 AM
if string.match(item.Name, "^Part") then

That's the only way I know to do things, I don't recall ever hearing about string.starts as a function. It may be, of course, but I don't know a thing about it.


Report Abuse
breakbroke9 is not online. breakbroke9
Joined: 05 Dec 2014
Total Posts: 51
11 Jul 2016 09:50 AM
Holy cow thanks it works.

string.starts(string, firstLetters) was supposed to return a boolean value according to some wikis I read but I probably used it wrong/wasn't a good idea to use, but it was so hard to understand :|.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
11 Jul 2016 09:51 AM
It might also be unavailable in Lua 5.1, which is what Roblox uses.
It's probably a 5.2 or 5.3 thing.


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