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: The Generic for.

Previous Thread :: Next Thread 
KOzero is not online. KOzero
Joined: 11 May 2010
Total Posts: 1411
07 Jul 2014 02:28 PM
Is it possible to have a for loop within another where I can use each of the array arguments?
Example:
p={}
d={}
for i,v in pairs (p) do
for e,z in pairs (d) do
end
end
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
07 Jul 2014 02:29 PM
Aye.
Report Abuse
KOzero is not online. KOzero
Joined: 11 May 2010
Total Posts: 1411
07 Jul 2014 02:34 PM
So this would work?


for i,v in pairs (game.Workspace:GetChildren()) do
for e,z in pairs (v:GetChildren()) do
if v.Name == "Car" and v.VehicleSeat.SeatWeld.Part1.Parent == character then
v.z.SpotLight.Enabled = true
end
end
end
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
07 Jul 2014 02:34 PM
As long as the objects exist in the proper place, yes.
Report Abuse
KOzero is not online. KOzero
Joined: 11 May 2010
Total Posts: 1411
07 Jul 2014 02:42 PM

Mouse.KeyDown:connect(function(Key)
if Key:lower() == "l" then
for i,v in pairs (game.Workspace:GetChildren()) do
for e,z in pairs (v:GetChildren()) do
if v.Name == "Car" and v.VehicleSeat.SeatWeld.Part1.Parent == character then
if z.Name == "Light" then
v.z.SpotLight.Enabled = true
end
end
end
end
end
end)

z is not a valid of model why is that?
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
07 Jul 2014 02:43 PM
Just z.SpotLight.
Report Abuse
KOzero is not online. KOzero
Joined: 11 May 2010
Total Posts: 1411
07 Jul 2014 02:47 PM
It worked perfectly.
With ever high gratitude.

KO~Out.
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
07 Jul 2014 02:51 PM
No prob.
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