So I found this cool way to a create custom event and I tried using the wait method on this event I made but it doesn't work why?
Library = assert(LoadLibrary("RbxUtility"))
Signal = Library.CreateSignal()
Signal:connect(function()
print('This is a connection')
print('Signal wait')
Signal:wait()
print('Done')
end)
print('Signal fired')
Signal:fire()
print('Signal fired once,again')
Signal:fire()
Do I have to fire the signal twice in order to make the wait work and how can I just fire it once to print 'done'?
Output:
Signal fired
This is a connection
Signal wait
Signal fired once,again
Done
This is a connection
Signal wait
I just want it to print:
Signal fired
This is a connection
Signal wait
Done
I just want to fire the event once so it can print "done".

15 comments
My own script isn't playing done in online. My place http://www.roblox.com/kevinnight45s-Place-Number-99-place?id=162582216 Check output in Server Console tab
Oh, delay is just like wait and do I have to put delay?
Event objects don't have a 'state.' There's no way to tell if an event fired in the past. You can only tell if an event fires after you start listening to the event.
So your problem is that you are firing the event, and then after it fires, you are waiting for it to fire again. But it never does.
Not really i'm just wanting it to fire like a touched:wait() or like button1down:wait() and there is no purpose to this script I just wanted to learn about signals :s.
Heres what I mean on this page http://wiki.roblox.com/index.php?title=User:JulienDethurens/Essays/Wait_method
How would I start to listen to a event?
By nature, what event:wait() does is stop the current thread and waits for the event to be fired.
So,it works differently with signals?
No, signals behave the same way as events.
I'm sorry,but I'm really confused so why isn't the wait part working?
It's working exactly as intended. The event is never being fired again. Think of it like firing a gunshot, and then waiting until you hear another gunshot. If no one fires another gunshot, you will be waiting forever.
So I changed some stuff(Updated Code above) and managed to print Done but firing the signal two times did I do it right?
How about you explain what you are trying to accomplish with your code?
I'm trying to make it print "Signal Fired","This is a connection" and "Signal wait","Done" by just firing the signal once and using the wait method.Like you did on your example