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: Do too much loops cause lag?

Previous Thread :: Next Thread 
Epiczombiekiller1998 is not online. Epiczombiekiller1998
Joined: 07 Aug 2011
Total Posts: 4918
22 Jul 2015 02:06 PM
An automatic gun in my game is supposed to do 10 shots in every second. But does about 2-3 instead. When I tried the same gun script in LocalScript the gun shot a lot faster, but I had to switch back to the normal script because the LocalScript DID clone the damage script into the bullets but they didn't even work for some reason. There are tons of loop scripts in my game, there are hundreds of street lamps what turn on at night and off at daylight, basically while wait (1) do scripts. And also cars, the loop checks a condition in every second that if the car health is below 100 then it should blow up and a lot other loops.
Report Abuse
Epiczombiekiller1998 is not online. Epiczombiekiller1998
Joined: 07 Aug 2011
Total Posts: 4918
22 Jul 2015 02:30 PM
Bump
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
22 Jul 2015 02:39 PM
Lots of loops cause lag
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 02:50 PM
yes, they can

when you use loops, make sure they are at least efficient, and you are using wait() wisely

http://blog.roblox.com/2012/05/using-wait-wisely/

also, as for your cars, if the "health" is an intvalue (or numbervalue, etc), use the .Changed event:

http://wiki.roblox.com/index.php?title=API:Class/IntValue/Changed
Report Abuse
ausomefire is not online. ausomefire
Joined: 20 Feb 2010
Total Posts: 373
22 Jul 2015 03:17 PM
if you do a loop you have to use wait() but even wait() uses treads from your cpu and still has to clone the waited seconds to the server. Its best to build 1 loop script for all your street lamps and use the least loops possible.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2015 03:20 PM
nope, just the sh itty free model ur using
Report Abuse
Epiczombiekiller1998 is not online. Epiczombiekiller1998
Joined: 07 Aug 2011
Total Posts: 4918
23 Jul 2015 03:51 AM
Wow, thanks guys (except BothAngles)! It actually worked, I changed tons of waits from 0.1 to larger numbers and also replaced lot of the loops with the .Changed event. Not only the automatic gun is shooting like its supposed to but also the customised character on spawning loads faster, and the doors don't lag anymore!
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