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: Scripting for beginers - Variables

Previous Thread :: Next Thread 
Despawned is not online. Despawned
Joined: 06 Apr 2013
Total Posts: 12569
24 Mar 2016 11:07 PM
I have seen that a lot of people seem to be having problems with variables. Most of these people are new to scripting, so I will go through it.

Variables are a way of shortening your code, and telling scripts to refer to a certain part in the studio. These can be models, unions, scripts, parts, tools, or really anything. You may have seen these before, here is what they look like, EXAMPLE:

Dog = game.Workspace.doghouse.dog

This is telling the script where to find the dog. First, it tells the script to go to the game, them workspace, then the model doghouse then dog.

Variables can also be able to shorten code. Say you wanted to refer to the dog again, you can just type "Dog" (case sensitive), instead of "Dog = game.Workspace.doghouse.dog"

I hope this helps some beginners out there, if you have any questions reply below.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
24 Mar 2016 11:19 PM
sorry but that line of code was annoying me.

local dog = workspace.Doghouse.Dog
Report Abuse
ClutchDeveloper is not online. ClutchDeveloper
Joined: 04 Aug 2013
Total Posts: 541
24 Mar 2016 11:29 PM
^


GavAttack12 // ClutchDeveloper
Report Abuse
greedyawesomeman is not online. greedyawesomeman
Joined: 18 Apr 2010
Total Posts: 1038
25 Mar 2016 12:18 AM
I never really got the purpose of declaring a variable local if it's not in something like and if statement. Care to elaborate?
Report Abuse
iQuit_ROBLOX is not online. iQuit_ROBLOX
Joined: 12 Mar 2016
Total Posts: 248
25 Mar 2016 12:24 AM
^ local variables process faster than global, barely, but still, you might as well.


Report Abuse
Neoryu is not online. Neoryu
Joined: 04 Mar 2012
Total Posts: 42
25 Mar 2016 01:07 AM
Where do you have proof of that?
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
25 Mar 2016 02:23 AM
The proof is in the source of Lua, it's open source.

A local variable lookup is a simple C-sided array lookup, a global variable lookup is a table lookup.
Report Abuse
swimmaster07 is not online. swimmaster07
Joined: 08 Jun 2013
Total Posts: 1459
25 Mar 2016 04:00 AM
I like how he spelled "beginners" wrong
Report Abuse
Despawned is not online. Despawned
Joined: 06 Apr 2013
Total Posts: 12569
25 Mar 2016 07:34 AM
I thought the "local" so I've been obvious, but yes. I should have included it.
Report Abuse
Despawned is not online. Despawned
Joined: 06 Apr 2013
Total Posts: 12569
25 Mar 2016 07:36 AM
This dang autocorrect makes me look like an idiot..
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