|
| 21 Jan 2012 04:23 PM |
I'm making a fort. That features a brick that If you shoot it 10 times, the brick's cancollide will be false and the bricks Transparency = 1. Which will reveal a secret entrance into the base. This function is somewhat like a WIJ door which I have seen in fort indigo but without all the GUI's. Heres what I got but i fail epiclly at scripting on the spot.
if script.Parent.HasTouched ("Laser1", 10) then script.Parent.CanCollide = false script.Parent.Transparency = 1 wait(60) script.Parent.CanCollide = true script.Parent.Transparency = 1 end
dont make fun of me, I'm just a beginner and I have little scripting knowledge as of this subject |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2012 04:25 PM |
`script.Parent.HasTouched` is not a valid member of Instance BaseClass. Meaning, `HasTouched()` isn't a real function...
TheNewScripter |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2012 04:30 PM |
| Yea, That was just one of my epic fails to script a function -.- |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 21 Jan 2012 04:44 PM |
You gave it a good shot!
local touchedTimes = 0 script.Parent.Touched:connect(function (hit) if hit.Name == "Laser1" then -- if it is hit by a laser then, touchedTimes = touchedTimes + 1 -- add 1 if touchedTimes == 10 then script.Parent.CanCollide = false script.Parent.Transparency = 1 wait(60) touchedTimes = 0 -- reset script.Parent.CanCollide = true script.Parent.Transparency = 0 end end end) |
|
|
| Report Abuse |
|
|
|
| 21 Jan 2012 04:57 PM |
| Thanks so much for your help! |
|
|
| Report Abuse |
|
|