poke114
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 2801 |
|
|
| 29 Sep 2012 11:13 PM |
This script is one of the first ones I'm trying to develop, and I can't seem to get it to work properly. I've tested and altered it multiple times. I expect it to make a certain brick transparent and turning it's CanCollide property to false for 5 seconds when touched. I've tested and altered it multiple times, but I still can't seem to find the problem. Some help would be appreciated a lot. The script is below.
local brick = Test Piece
function (OnTouch) part brick.Transparency=1 wait (5) brick.Transparency=0
brick.touched:connect (OnTouch)
end
function (OnTouch) part brick.CanCollide=false wait(5) brick.CanCollide-false
brick.touched:connect (OnTouch) |
|
|
| Report Abuse |
|
|
| |
|
poke114
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 2801 |
|
|
| 29 Sep 2012 11:15 PM |
@thedeathmaster01
The specific brick the script is referring to. I just named it that to make the script easier to make. |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 11:23 PM |
Easier or no, it's no surprise it doesn't work. You listed your argument incorrectly; it should be-
function OnTouch(part)
after that, any instance of 'part' will be the part that touched the brick, but that's irrelevant to this. Another thing; 'Test Piece' should have been equivalent to 'script.Parent', unless that's what 'brick' is.
Also, you didn't need two separate functions. You can combine a transparency function with a cancollide function. It'd look something like this...
X.Transparency = 1 X.CanCollide = false
Ultimately, you end up with something like this. But obviously not like this.
function Monkeyfarts(hooplah) script.Parent.BrickColor = tostring("Bright Red") script.Parent.Velocity = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100)) end
script.Parent.Touched:connect(Monkeyfarts) |
|
|
| Report Abuse |
|
|