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
 

please help with super short script

Previous Thread :: Next Thread 
RoQuick is not online. RoQuick
Joined: 12 May 2013
Total Posts: 595
24 Feb 2016 10:06 PM
while test.Value == true do
for i = 30,0,-1 do
text.Text = i
wait(1)
end
end

i want the for function to work but only if the test.value is true and make it stop when its false
please help
Report Abuse
RoQuick is not online. RoQuick
Joined: 12 May 2013
Total Posts: 595
24 Feb 2016 10:06 PM
sorry I should have said more

this script works but if the test.Value turns to false, the countdown will still continue
Report Abuse
Contrary is not online. Contrary
Joined: 08 Jan 2011
Total Posts: 1306
24 Feb 2016 10:11 PM
Well, the issue comes from the fact that the loop will execute if the value is "true", and it'll keep running what's inside until it's over. In this case, you have a for-loop... so that will have to finish before it checks if the value is "true" again.


Try something like:

for i = 30,0,-1 do
if test.Value == true then
text.Text = i
end
wait(1)
end
end
Report Abuse
malachi11 is not online. malachi11
Joined: 07 May 2008
Total Posts: 2420
24 Feb 2016 10:11 PM
A while loop only checks if it is still true after the loop is finished. In this case, after the countdown is done. You could do something like this:




while test.Value == true do
for i = 30,0,-1 do
if (test.Value~=true) then
break --This will immediately cancel the for loop, then the script will go back to the while loop and end that too.
end
text.Text = i
wait(1)
end
end
Report Abuse
RoQuick is not online. RoQuick
Joined: 12 May 2013
Total Posts: 595
24 Feb 2016 10:16 PM
thank u guys
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