|
| 08 Apr 2012 01:10 PM |
== Output: Workspace.Part.Script:1:attempt to index global 'Script' (a nil value)
local door = Script.Parent -- Script.Parent refers to the Part the Script is in. function onTouch() -- When the brick is touched... (start of function) door.CanCollide = false -- Now we can walk through it door.Transparency = 0.5 -- Now is semi-transparent door.BrickColor = BrickColor:Random() -- Assigns a random color wait(2) -- 2 seconds later... door.CanCollide = true -- Now we can no longer walk through the door door.Transparency = 0 -- Now is not transparent door.BrickColor = BrickColor:Random() -- Assigns another random color end -- ends function door.Touched:connect(onTouch) -- door is now connected to our function |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Apr 2012 01:21 PM |
It is "script.Parent", notice the lowercase "s".
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 01:27 PM |
| Thanks KNIGHT, that works, but I don't understand. The Script is named "Script", with a capital S, so why should it be lowercase |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 01:32 PM |
You can name the script anything, but to access it, the variable is always "script".
† KMXD † |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 08 Apr 2012 01:33 PM |
| 'script' refers to the script that the code is in, so it basicly doesn't matter what the name of it is. That is just used for organizing. |
|
|
| Report Abuse |
|
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 08 Apr 2012 01:34 PM |
Dang it Knight...
Plus I joined a week or two before ya. |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 01:36 PM |
Ok, does it matter...? Though I am jealous of your hat. I hadn't learn to script 'till last year.
:c
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2012 01:54 PM |
| Oh ok, that makes since. Thanks. |
|
|
| Report Abuse |
|
|