| |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 08 Aug 2013 06:04 PM |
variable = 3 do local scopedVariable = 3 end |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2013 06:05 PM |
| Blocco what does the do and end do in that block of code? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 06:08 PM |
umg, i meant
local stuff = game.Workspace.Part |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 08 Aug 2013 06:17 PM |
local variable = "myVariable"
? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
| |
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
| |
|
|
| 08 Aug 2013 06:48 PM |
| @ZachBloxx, So I am assuming that I have to put it in a Local script? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 08 Aug 2013 06:54 PM |
| Here is the current code: http://www.lualearners.org/forum/10266 |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 08 Aug 2013 06:57 PM |
| Ohhh, I didn't see that typo. |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2013 07:00 PM |
| Well now it say's BillboardGui is not a valid member of "Model" |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
|
| 08 Aug 2013 07:33 PM |
| And it doesn't work. It says same thing. |
|
|
| Report Abuse |
|
|