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
 

Using next with a for loop

Previous Thread :: Next Thread 
bobafett3544 is not online. bobafett3544
Joined: 16 Apr 2011
Total Posts: 180
08 Sep 2014 06:36 PM
How do I use next in a generic for loop? I just need an example. Please help!
Report Abuse
bobafett3544 is not online. bobafett3544
Joined: 16 Apr 2011
Total Posts: 180
08 Sep 2014 06:46 PM
Buuump. I'm not asking for someone to make a script, just give an example, just like a table with 2 messages in it, and print them in order.
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
08 Sep 2014 06:56 PM
table = {"Apple","Pie","Pickles"}

for i,v in next, table do
print(v)
end

>Apple
>Pie
>Pickles
Report Abuse
bobafett3544 is not online. bobafett3544
Joined: 16 Apr 2011
Total Posts: 180
08 Sep 2014 07:00 PM
Say you touch a brick and have the loop execute. Is there a way just to have it print one at a time, like on the first touch it prints "Apple", then the next one "Pie"?
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
08 Sep 2014 07:03 PM
part = workspace.Part

n = 0
db = false

part.Touched:connect(function(h)
if not db then
db = true
n = n + 1
if n == 1 then
print("Apple")
elseif n == 2 then
print("Pie")
elseif n == 3 then
print("Pickles")
end
end
wait(1)
db = false
end)
Report Abuse
bobafett3544 is not online. bobafett3544
Joined: 16 Apr 2011
Total Posts: 180
08 Sep 2014 07:06 PM
I guess the non-table version will have to do. Thanks though, man. Now I know about next.
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