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: I'm not super sure on how to use "until" here

Previous Thread :: Next Thread 
zub74 is not online. zub74
Joined: 13 Sep 2008
Total Posts: 489
08 Jun 2014 05:04 PM
if workspace.Cash.Value>= workspace.Limit.Value then
--stuff

else
while wait(1) do
workspace.Cash.Value=workspace.Cash.Value+workspace.Rate.Value
until workspace.Cash.Value>= workspace.Limit.Value
end
end

The until line is underlined in red. What's wrong with it?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 05:05 PM
repeat-until
repeat workspace.Cash.blah = blh until workspace.Cash.Value >= blah
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:06 PM
repeat
wait (1)
workspace.Cash.Value=workspace.Cash.Value+workspace.Rate.Value
until
workspace.Cash.Value>= workspace.Limit.Value
end
end

while wait (1) do end does something every 1 second forever unless broken.
Report Abuse
zub74 is not online. zub74
Joined: 13 Sep 2008
Total Posts: 489
08 Jun 2014 05:08 PM
And would the script resume if the cash value was once again lowered below the limit value?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:08 PM
No, that's where the while loop comes in

while wait () do
repeat
-- stuff
until
-- condition
end
Report Abuse
zub74 is not online. zub74
Joined: 13 Sep 2008
Total Posts: 489
08 Jun 2014 05:15 PM
It doesn't stop upon reaching the condition.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:18 PM
What? It should!

Describe in detail what happens with these added print statements:

while wait () do
print 'checking'
repeat
--stuff
print 'adding'
until
--condition
print 'achieved!'
end
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Jun 2014 05:19 PM
while (workspace.Cash.Value < workspace.Limit.Value) and Wait(1) do
workspace.Cash.Value = workspace.Cash.Value+workspace.Rate.Value
end
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
08 Jun 2014 05:20 PM
repeat
--code
until
--statement

or
While statement~=bool do
--code
end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 05:21 PM
Knightmare's method is better because if Cash.Value is more than limit.Value before hand, it won't add any/
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Jun 2014 05:24 PM
You might want to set it to the limit afterwards as it could go above it if the limit isn't divisible by the rate.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 05:25 PM
math.min is your friend
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
08 Jun 2014 05:26 PM
wow, I'm stupid.
Knightmare's is a great method.
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