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: Short script, need to stop a loop.

Previous Thread :: Next Thread 
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Nov 2012 05:18 PM
What it does? It's a spree script, the person gets a point, and the count-down time resets to 20, but my problem is the break doesn't work because I cant think of a system that would get the loop to restart if player gets more points.




script.Parent.Parent.CurrentPoints.Changed:connect(function()
ready = false
time = 20
ready = true
for i = time, 1 ,-1 do
if ready == false then break end
wait(1)
time = time -1
print(time)
if time == 1 then
script.Parent.Parent.CurrentPoints.Value = 0
end
end

end)
Report Abuse
squirrelterritory is not online. squirrelterritory
Joined: 17 Sep 2011
Total Posts: 276
30 Nov 2012 05:26 PM
Use the term "break" in the script where you want it to break
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Nov 2012 05:27 PM
Please look at what I've done.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 05:32 PM
This really makes no sense, as the functions fires when the value is changed, and you are changing it within your loop.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 05:34 PM
So you are trying to make the script break when the spree has ended I am assuming.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 05:35 PM
You could use a while loop.
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Nov 2012 05:37 PM
Argh nope. :/

There is a time limit, a person scores a point and the time limit sets off, if it reaches 0, the spree points returns to 0, but if they score another point during the count down, the count down restarts back at 20.



I know this is confusing, it's basically like stacking points.
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Nov 2012 05:38 PM
I have done:


script.Parent.Parent.CurrentPoints.Changed:connect(function()
ready = false
time = 20
wait()
ready = true

while ready == true do
if ready == false then break end
wait(1)
time = time -1
print(time)
if time == 0 then
script.Parent.Parent.CurrentPoints.Value = 0 --reset the spree :) DIE! lolol!
break
else
end
end

end)


problem is that it has the same effect as the for loop, it will continue to count down in 2s showing that the loop never stoped when the time restarted,
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
30 Nov 2012 05:42 PM
Never mind, the wait just needed to be longer.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 05:43 PM
ready = false
time = 20
wait()
ready = true

I don't quite understand the purpose of that.
Report Abuse
iBrilliance is not online. iBrilliance
Joined: 19 Oct 2012
Total Posts: 1032
30 Nov 2012 05:43 PM
Alright.
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