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
 

Miscalculation with loops

Previous Thread :: Next Thread 
RockTheMIC is not online. RockTheMIC
Joined: 22 Jul 2011
Total Posts: 2319
22 Apr 2016 09:27 PM
num = script.Parent.num
while wait() do
wait()
script.Parent.num.Value = script.Parent.num.Value *script.Parent.num2.Value
end

(num and num2 are values that need to constantly change)

The problem here is, with the while wait() do, it keeps multiplying the number. Is there any way so that, it only does a single multiplication calc when the values are changed?
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
22 Apr 2016 09:34 PM
deb = true
script.Parent.num.Changed:connect(function(prop)
if prop=='Value' and not deb then
deb = true
script.Parent.num.Value = script.Parent.num.Value*script.Parent.num2.Value
end
wait()
deb=false
end)
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