ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
|
| 05 Jul 2014 12:16 AM |
In my script, I am trying to make a block, once stepped on, start disappearing, and then become invisible and able to go through, and then after a few seconds, come back to how it was originally. This is working just fine, until it's supposed to return to normal. It doesn't return until it is stepped on again. Here is my script:
p = script.Parent
p.Touched:connect(function(onTouch) wait(3) p.Transparency = .5 wait(.5) p.Transparency = 1 p.CanCollide = false wait(3) p.Transparency = 0 p.CanCollide = true end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2014 12:17 AM |
Try adding a debounce, http://wiki.roblox.com/index.php?title=Debounce |
|
|
| Report Abuse |
|
|
ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
|
| 05 Jul 2014 12:23 AM |
I did, and it gave the same output. Here's my new code:
p = script.Parent
local brickTouched = false
p.Touched:connect(function(onTouch) if not brickTouched then brickTouched = true wait(3) p.Transparency = .5 wait(.5) p.Transparency = 1 p.CanCollide = false wait(3) p.Transparency = 0 p.CanCollide = true brickTouched = false end end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2014 12:50 AM |
| Did you wait a few seconds for it to reappear?. |
|
|
| Report Abuse |
|
|
ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
| |
|
|
| 05 Jul 2014 12:56 AM |
| Try anchoring the brick and inform me of the result. |
|
|
| Report Abuse |
|
|
ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
|
| 05 Jul 2014 12:57 AM |
| It was anchored originally. Un-anchoring it gives the same result. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2014 01:00 AM |
| Try removing the first wait(). |
|
|
| Report Abuse |
|
|
ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
|
| 05 Jul 2014 01:02 AM |
| Oh my gosh I am such an idiot. I was editing the wrong script. The debounce method ended up working, and sorry for leading you on. |
|
|
| Report Abuse |
|
|
ecolon
|
  |
| Joined: 10 Aug 2010 |
| Total Posts: 182 |
|
| |
|
|
| 05 Jul 2014 01:06 AM |
| It's no problem, good to see that you resolved it. |
|
|
| Report Abuse |
|
|