emite1000
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 46 |
|
|
| 27 Jun 2013 12:26 PM |
So I had this door with a decal in the middle, and when you clicked on it the door would fade away, then reappear 3 seconds later. The script worked fine until yesterday. I did not edit it or anything, it does everything right up until the part where it is supposed to reappear, it doesn't!
What is the problem?
local brick = Workspace.Thing local print = Workspace.Thing.Part local pic = Workspace.Thing.Part.Decal
function onClicked (part) brick.Transparency = 0.1 print.Transparency = 0.1 pic.Transparency = 0.1 wait(0.1) brick.Transparency = 0.2 print.Transparency = 0.2 pic.Transparency = 0.2 wait(0.1) brick.Transparency = 0.3 print.Transparency = 0.3 pic.Transparency = 0.3 wait(0.1) brick.Transparency = 0.4 print.Transparency = 0.4 pic.Transparency = 0.4 wait(0.1) brick.Transparency = 0.5 print.Transparency = 0.5 pic.Transparency = 0.5 wait(0.1) brick.Transparency = 0.6 print.Transparency = 0.6 pic.Transparency = 0.6 wait(0.1) brick.Transparency = 0.7 print.Transparency = 0.7 pic.Transparency = 0.7 wait(0.1) brick.Transparency = 0.8 print.Transparency = 0.8 pic.Transparency = 0.8 wait(0.1) brick.Transparency = 0.9 print.Transparency = 0.9 pic.Transparency = 0.9 wait(0.1) brick.Transparency = 1 print.Transparency = 1 pic.Transparency = 1 brick.CanCollide = false print.CanCollide = false wait(3) brick.Transparency = 0 print.Transparency = 0 pic.Transparency = 0 brick.CanCollide = true print.CanCollide = true end print.ClickDetector.MouseClick:connect(onClicked)
("Thing" is the name of the door part) |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 27 Jun 2013 12:31 PM |
Your problem could be that you're not using a debounce.
local brick = Workspace.Thing local print = Workspace.Thing.Part local pic = Workspace.Thing.Part.Decal debounce = true
function onClicked (part) if debounce then debounce = false for i = 0.1,1,1 do brick.Transparency = i print.Transparency = i pic.Transparency = i wait(0.1) end brick.CanCollide = false print.CanCollide = false wait(3) brick.Transparency = 0 print.Transparency = 0 pic.Transparency = 0 brick.CanCollide = true print.CanCollide = true debounce = true end print.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
emite1000
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 46 |
|
|
| 27 Jun 2013 12:41 PM |
I added debounce and it didn't work. I even tried replacing my whole script with yours and it didn't work either.
I thought debounce was for making sure that a command only executes once, and not get spammed. How would it help in this situation (I am still a basic scripter). |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 27 Jun 2013 12:54 PM |
I added the debounce so that the function wouldn't be called multiple of times by spam clicks.
It STILL doesn't work? No output?
Could you please make it into a model and allow me to check it? |
|
|
| Report Abuse |
|
|
emite1000
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 46 |
|
|
| 27 Jun 2013 01:02 PM |
http://www.roblox.com/the-door-item?id=120616219
Published on my alt account. |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 27 Jun 2013 01:06 PM |
Make the model public domain. Can't take it at this time because it's locked. |
|
|
| Report Abuse |
|
|
emite1000
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 46 |
|
|
| 27 Jun 2013 01:10 PM |
| Sorry. Try this: http://www.roblox.com/door2-item?id=120617580 |
|
|
| Report Abuse |
|
|
RoAnt
|
  |
| Joined: 14 Jul 2008 |
| Total Posts: 16794 |
|
|
| 27 Jun 2013 01:16 PM |
Lol, okay. I see your problem.
Since the big part isn't anchored, once the code hit to the CanCollide = false, the part will fall straight down to the void, removing it from workspace.
And I also saw my code's problem. I forgot an end to close my if statement. *facepalm*
Anyways, to solve this, just Anchored your door! :D |
|
|
| Report Abuse |
|
|
emite1000
|
  |
| Joined: 11 Mar 2011 |
| Total Posts: 46 |
|
|
| 27 Jun 2013 05:46 PM |
Oh duh! I had my door Anchored, but then it stopped working so I un-anchored it to see if it would fix the problem. I guess I forgot to re-anchor it again :).
Thanks. |
|
|
| Report Abuse |
|
|