|
| 09 Apr 2012 05:20 PM |
script.Parent.Touched:connect(function() local bool, err = pcall(function()
print("YEAH TOUCHED") wait(3) print("3 SECONDS LATER") end)
end) if not bool then print("Error with teleporter.") end
It prints the first message, but when it tries to print the second message, the output says: attempt to call a nil value cannot resume non-suspended coroutine |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 09 Apr 2012 05:27 PM |
| Bool is local, and you end the function before you call bool. |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2012 05:29 PM |
I'm still getting the same error messages.
It should be noted that it works fine when the wait and second print message are gone. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 09 Apr 2012 05:34 PM |
bool = false script.Parent.Touched:connect(function() bool = true print("YEAH TOUCHED") wait(3) print("3 SECONDS LATER") end)
if bool == false then print("Error with teleporter.") end
Try that :P |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2012 05:39 PM |
| Thanks, I've got it working! |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 09 Apr 2012 05:46 PM |
Miz he's using pcall, not just a bool.
script.Parent.Touched:connect(function() running, error = pcall(function() print("YEAH TOUCHED") wait(3) print("3 SECONDS LATER") end) if not running then print(script:GetFullName().." > Error > "..error) end end)
|
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 09 Apr 2012 05:47 PM |
| I know, but I didn't like that code for some reason :P |
|
|
| Report Abuse |
|
|