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: What does for 1=#d

Previous Thread :: Next Thread 
BkFries is not online. BkFries
Joined: 07 Jun 2009
Total Posts: 42
23 Jul 2012 11:07 PM
Or whatever that is? What does that do and mean?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Jul 2012 11:10 PM
Well it depends what d is. What's the value of that variable?
Report Abuse
BkFries is not online. BkFries
Joined: 07 Jun 2009
Total Posts: 42
23 Jul 2012 11:13 PM
i meant for 1 = #1
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Jul 2012 11:28 PM
What? A for loop takes a local variable, and 2 numbers minimum.

You have

for 1 = #1

To Lua, 1 is the variable and you only have one number(depending on #1 is).

....

Report Abuse
troop98 is not online. troop98
Joined: 19 Dec 2009
Total Posts: 1476
24 Jul 2012 09:43 AM
Ok cool
Report Abuse
builderman1171 is not online. builderman1171
Joined: 27 Mar 2010
Total Posts: 1595
24 Jul 2012 09:49 AM
It's a way of repeating something x number of times (This is one type of 'for' loop) Let's say we wanted to print 'Hi' 10 times, and also print what number of 'Hi' we're at.

for i=1,10 do
print'Hi '..i
end

Now, how will this print what number we're at? Well, the 'i' is automatically added '1' to it after each loop. So our output would be:

Hi 1
Hi 2
Hi 3
ect..

Now, what about the other type of 'for' loop? This one is usually used for a 'search' or to gather all the 'children' of on element.

for _,n in pairs(game.Players:GetChildren()) do --Get all of the 'Player' elements.
if n.Name=="builderman1171" then --Find my name
print'Buiderman1171 is in the game!' --Print, I am there.
end
end

--TehChikenHater ლ(ಠ_ಠლ)
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