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: What is local?

Previous Thread :: Next Thread 
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
11 Apr 2013 04:38 PM
Whats the difference between:

brick = Instance.new("Part")

and

local brick = Instance.new("Part")

Is local only ever used in local scripts?
Report Abuse
buddy249950 is not online. buddy249950
Joined: 30 Jun 2016
Total Posts: 3536
11 Apr 2013 04:39 PM
Local makes it run faster and more efficiently. It's also specified to the function it is in.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
11 Apr 2013 04:48 PM
So if I have a function that creates a part, just putting local infront of it will make it run better?
Report Abuse
sloomingbla is not online. sloomingbla
Joined: 28 Jun 2008
Total Posts: 1109
11 Apr 2013 04:51 PM
Here is an example.

function thing()

local a = Instance.new("Part")

a.Parent = game.Workspace would work here, because a was specified as local inside of the function, and this line is also inside of the function

end

thing()

a.Parent = game.Workspace wouldnt work here, because a will only work in the function it was created in, being as its local.

besides that, local variables will be slightly more efficient.
Report Abuse
MattDominator is not online. MattDominator
Joined: 20 Oct 2008
Total Posts: 3981
11 Apr 2013 04:55 PM
Ah, I get it now. Thanks!
Report Abuse
sloomingbla is not online. sloomingbla
Joined: 28 Jun 2008
Total Posts: 1109
11 Apr 2013 04:57 PM
np ;)
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