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: How do you define a variable?

Previous Thread :: Next Thread 
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:03 PM
?
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
08 Aug 2013 06:04 PM
var = 0

print(var)
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
08 Aug 2013 06:04 PM
    variable = 3
    do
        local scopedVariable = 3
    end
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
08 Aug 2013 06:05 PM
Blocco what does the do and end do in that block of code?
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
08 Aug 2013 06:06 PM
nothing special; it just creates a block of code in which a more local scope exists, in case you want don't want to use anonymous functions to do stuff
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
08 Aug 2013 06:07 PM
A variable is a letter/word that contains info
local make it so at the end you dont know
do
 local c = hi.Parent
--having hi defined
end
--Cant acess c after the end
In the begginging of scripts, many people do a ton of locals
or, just do something with no 'local' will work throughout the whole script
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:07 PM
It's an example how to use local on a variable in the scope.

Like:

if condition then
local stuff = game.Workspace.Parent
end

'stuff' will only be recognized within the scope of the if statement.
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:08 PM
umg, i meant

local stuff = game.Workspace.Part
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:15 PM
What about in this code? How would I define a variable in this code?


http://www.lualearners.org/forum/10266
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:17 PM
local variable = "myVariable"

?
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
08 Aug 2013 06:17 PM
ewwwwww

Enabled is nil
LockedDoor1 is nil

what are you doing bro
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:20 PM
oh i see now

local LockedDoor1 = game.Workspace.LockedDoor
LockedDoor1.BillboardGui.Enabled = true
Report Abuse
blackshockwave is not online. blackshockwave
Joined: 16 Mar 2012
Total Posts: 1381
08 Aug 2013 06:46 PM
Player = script.Parent
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:47 PM
@black, wat?
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:48 PM
@ZachBloxx, So I am assuming that I have to put it in a Local script?
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
08 Aug 2013 06:50 PM
^ yo i showed u how to define variables
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:51 PM
Just because you put local in a script does not mean it must be in a Local Script. Local Scripts are for client-sided things only.
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:54 PM
@ZachBloxx Ok, well here is the output: 18:50:50.469 - LockedDoor is not a valid member of Workspace
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:54 PM
Here is the current code: http://www.lualearners.org/forum/10266
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 06:55 PM
.. that's because you don't an object in workspace named "LockedDoor"
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 06:57 PM
Ohhh, I didn't see that typo.
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 07:00 PM
Well now it say's BillboardGui is not a valid member of "Model"
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
08 Aug 2013 07:04 PM
Then put a BillboardGui named "BillboardGui" in the model.
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 07:21 PM
I did.
Report Abuse
beastyfootballtim is not online. beastyfootballtim
Joined: 30 Oct 2010
Total Posts: 1080
08 Aug 2013 07:33 PM
And it doesn't work. It says same thing.
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