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: Quick Question: Would this for loop in the for loop work?

Previous Thread :: Next Thread 
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
26 Jan 2015 04:09 PM
Frames = {
script.Parent:WaitForChild("CitizensTeam"),
script.Parent:WaitForChild("TroopsTeam"),
script.Parent:WaitForChild("RoyaltyTeam"),
script.Parent:WaitForChild("CommanderTeam")
}

for i, v in pairs(Frames) do
Buttons = {"Citizens", "Troops", "Royalty", "Commanders"}
for i, v in pairs(Buttons) do
--Script
end
end

--All of the Buttons are Children of the Team Frames.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jan 2015 04:11 PM
It'd kinda work but I have no idea why you're doing that.
1) You're reusing i and v - might be what you intended by can be bad practice
2) Move the buttons declaration out of the loops (and use local)
3) What are you trying to do? If you're adding each button to the frame then you might want to use a numeric for to preserve order.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
26 Jan 2015 04:11 PM
Don't declare Buttons repeatedly, and even if you did, it should be local. Put Buttons at the top.

Yes, it would work. The inner loop would use the i and v for the inner loop, the outer loop would use the outer loop's.
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
26 Jan 2015 04:19 PM
Alright.

"I like to program." - Bosswalrus
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