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: Whats the difference between local and, well, not local?

Previous Thread :: Next Thread 
chicka123 is not online. chicka123
Joined: 05 Jul 2008
Total Posts: 25356
06 May 2012 07:28 PM
Local > Not local?
Local < Not local?
Local = Not local
I know local is another word for client, but I don't understand..
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
06 May 2012 07:58 PM
Local stuff runs on the Client.


Think of this:

A Teacher is the Server. Students are the Client.

The Teacher tells students to do something. The Students all do it. However, Students also do their own individual stuff.


Your Computer is the "Student" or client when on an online game. The computer hosting that game is the Server.

Things that happen on the Server are usually seen on all clients. Things that only happen on the Client are usually only seen on the client.


Try googling "Server vs. Client"
Report Abuse
Aerideyn is not online. Aerideyn
Joined: 16 Jan 2010
Total Posts: 1882
06 May 2012 08:15 PM
in a script, the term "local" means the variable only exists in the scope it was declared.

for example in a counter function..

a = 0
function count()
a = a +1
print("inside count: " .. a)
end
count()
print("after count: ".. a)

the output will be:
> inside count: 1
> after count: 1

but if we change it...

a = 0
function count()
local a = a +1
print("inside count: " .. a)
end
count()
print("after count: " .. a)

the output will be:
> inside count: 1
> after count: 0

since the local variable a only exists inside that function!
Report Abuse
MetroidSlayer is not online. MetroidSlayer
Joined: 14 Dec 2009
Total Posts: 845
06 May 2012 08:19 PM
Also (according to the wiki) a local is only equal to the value that you set it in the function that you set it in. It is good for when you have a lot of functions inside one script. For instance, here is an example script:

car = 5
print(car)
function change()
local car = 10
print(car)
end
change()
print(car)

Output:
5
10
5
Report Abuse
MetroidSlayer is not online. MetroidSlayer
Joined: 14 Dec 2009
Total Posts: 845
06 May 2012 08:20 PM
Late Post Fail...
xD
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