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: Better Scripting

Previous Thread :: Next Thread 
spartan6241 is not online. spartan6241
Joined: 15 Jun 2014
Total Posts: 793
27 Dec 2015 09:31 PM
I heard that some scripts can use up a lot of your device's power and causes games to be laggy if they are not made efficiently. What are some methods of making efficient and nonlaggy scripts?
Report Abuse
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
27 Dec 2015 09:37 PM
A combination of local scripts and variables. You do not want the server to be overwelmed nor do you want the client. Correct me if I'm wrong.
Report Abuse
spartan6241 is not online. spartan6241
Joined: 15 Jun 2014
Total Posts: 793
27 Dec 2015 09:41 PM
Woulds using local variables rather than typing a lot into each line make a difference and make the game less laggy?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Dec 2015 09:42 PM
Use loops if you need to, but try to use events when you can. When using a loop (especially if it is an infinite loop), don't try to do something really intensive within too short of a pause between intervals of your loop.

Small things (but important) to consider might be using the Destroy method instead of remove. There's things to consider when using FE too, such as trying to avoid doing too many intensive/expensive tasks at once within a server script.

I'd say tootoo was right; you need to try to get a good balance between using Local scripts and Server scripts. You don't want to overwhelm the server or the client, a good balance is just right.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
27 Dec 2015 09:45 PM
Let's not do stuff like:

local done = false
partA.Touched:connect(function()
done = true
end)
partB.Touched:connect(function()
done = true
end)
while not done do -- Gross loop
wait()
end
print "done"


Let's do:

local done = Instance.new("BindableEvent")
partA.Touched:connect(function()
done:Fire()
end)
partB.Touched:connect(function()
done:Fire()
end)
done.Event:wait()
print "done"


Report Abuse
spartan6241 is not online. spartan6241
Joined: 15 Jun 2014
Total Posts: 793
27 Dec 2015 09:46 PM
So you mean don't overuse wait() unless you REALLY need it?
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
27 Dec 2015 10:00 PM
@spart My thing is waiting for one of multiple events to fire.

Making the bindable and using :wait() basically C-Sides the waiting. Less work on Lua engine (not sure if that's the best wording?}
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