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: Explain "Looping" to me plz

Previous Thread :: Next Thread 
SarahTrysTruth is not online. SarahTrysTruth
Joined: 01 Dec 2013
Total Posts: 480
29 Mar 2016 01:27 PM
Im reading the wiki and the example of looping they give confuses me.

number = 0
while true do
number = number + 1
print(number)
wait(1)
end
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
29 Mar 2016 01:28 PM
while true do
print("Hey")
wait(1)
end

that would print "Hey" every 1 second because loops just go back to the start of the scope



#code R+ | local RAP = "R$384,047"; local robux = "R$1,572"
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
29 Mar 2016 01:29 PM
Initially, it sets the variable 'number' to 0, then it will:

- 1. add one to number
- 2. print it
- 3. wait 1 second
- 4. go back to step 1
Report Abuse
ghostleader is not online. ghostleader
Joined: 16 Feb 2008
Total Posts: 1131
29 Mar 2016 01:31 PM
Lets break it down.

number = 0
-- This is a variable that holds a number.


while true do
-- This is the start of the loop, Basically it says Repeat loop until true. This could be extended upon like "while number < 50 do", so it repeats until the number 50 or higher. Since it is checking if the number is Less than 50.

number = number + 1
-- This is adding 1 to the number variable, so every time this loop runs, it adds 1.

print(number)
-- This just outputs/prints the number to the console/log

wait(1)
-- Wait is literally to wait in seconds. In this case, 1 second.

end
-- This end is the end of the loop, basically ends the block of code.
Report Abuse
SarahTrysTruth is not online. SarahTrysTruth
Joined: 01 Dec 2013
Total Posts: 480
29 Mar 2016 01:35 PM
All of these were very helpful thanks!
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