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: No Loop to break

Previous Thread :: Next Thread 
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:03 AM
I'm getting that error in this script, not sure why because I have 'break' inside the for loop:

for i = 1,30 do
clicking.Value.Changed:connect(function()
if clicking.Value==2 then
break --?
end
end)
reclaim.Value = reclaim.Value+1
bar.Size = UDim2.new((i*.3333333333333333333334)/10,-8,1,-8)
wait(1)
end
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:03 AM
Woah, the website screwed that layout up
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
10 May 2015 10:04 AM
Just use "return true", it basicly does the same.
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:05 AM
Thanks
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
10 May 2015 10:08 AM
np
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:09 AM
Doesn't seem to work, it will print 'd' when the value is changed, but the loop will continue and not print 'done' until it's done looping:

for i = 1,30 do
clicking.Changed:connect(function()
if clicking.Value==2 then
print("d")
return true
end
end)
reclaim.Value = reclaim.Value+1
bar.Size = UDim2.new((i*.3333333333333333333334)/10,-8,1,-8)
wait(1)
end
print("done")
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:19 AM
Bump
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:28 AM
Bump
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:35 AM
Bump
Report Abuse
ganger800 is not online. ganger800
Joined: 06 Dec 2012
Total Posts: 427
10 May 2015 10:40 AM
The program will do the fellowing:
- connect 30 times clicking.Changed
- you press something, which will fire the print("d")

however the connected function has no effect to the loop (I think something with scoop)
that is why the loop continues (and break/return has not the effect you want)

solution:
declare a variable before the loop and check it every loop
only 1 time connect the .Changed and change the variable when fired
Report Abuse
KLGA is not online. KLGA
Joined: 19 Apr 2014
Total Posts: 2571
10 May 2015 10:41 AM
Alright, I'll give this a try, thanks ganger.
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