Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 23 Nov 2013 01:41 PM |
Well, what this is supposed to do:
When a player touches a brick, two doors begin to open at the same time, thus having to use a coroutine. Then after 5 seconds, the doors close once again at the same time.
Problem: When I step on the brick, nothing happens. I'm fairly new to coroutines so that may be the problem. I tried it before without coroutines, and they basically open and close one at a time, but I want them to open both at the same time. Once again, no output.
SCRIPT: leftDoor = script.Parent.Parent.LeftDoor rightDoor = script.Parent.Parent.RightDoor
debounce = false
function openDoor(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then if (debounce == false) then debounce = true wait(0.5) local openLeft = coroutine.wrap(function() for i = -0.972, -6.972, -.100 do wait() leftDoor.CFrame = CFrame.new(i, 0.63, -14.453) end end) local openRight = coroutine.wrap(function() for n = 5.156, 11.156, .100 do wait() rightDoor.CFrame = CFrame.new(n, 0.63, -14.445) end end) wait(4) local closeLeft = coroutine.wrap(function() for x = -6.972, -0.972, .100 do wait() leftDoor.CFrame = CFrame.new(x, 0.63, -14.453) end end) local closeRight = coroutine.wrap(function() for v = 11.156, 5.156, -.100 do wait() rightDoor.CFrame = CFrame.new(v, 0.63, -14.445) end end) end end end
debounce = false
script.Parent.Touched:connect(openDoor)
Any help? |
|
|
| Report Abuse |
|
|
Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
| |
|
|
| 23 Nov 2013 01:49 PM |
Dog goes woof Cat goes meow Bird goes tweet and mouse goes squeek
Cow goes moo Frog goes croak and the elephant goes toot
Ducks say quack and fish go blub and the seal goes ow ow ow
But theres one sound That no one knows What does the output says? |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 23 Nov 2013 01:50 PM |
| (Funny, but the question asker did say "Once again, no output.")... |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2013 01:51 PM |
| Oh, then you shouldn't put these long stories about the script... |
|
|
| Report Abuse |
|
|
|
| 23 Nov 2013 01:53 PM |
The problem is that there is no bug. The coroutines just never gets activated.
Try to replace all the "wrap"s with "resume"s. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|