I’m trying to create custom events without using something such as a BindableEvent, and I have been able to do this. So far :Connect() is implemented.
The problem I came to was implementing :Wait() because I have to be able to pause either the script or thread that the script which called :Wait() and unpause it when the event is fired.
My first thought was repeating wait() until the event is fired, but before even trying I thought that this would be a bad idea, even if it worked. Surely there’s a more efficient method for going around this?
My custom events thing is a metatable inside of a module script called Utils. This metatable has three methods and two fields. The methods are Connect (connects a function to be called when the event is fired), Wait (waits until the event is fired before running any code after the statement), and _Fire (fires the event).
I need to find a way to pause the thread or script that called the Wait method and unpause is when _Fire is called (so when the event fires). My problem is mostly that I have no idea how to get whatever script my function is being called from, so I can’t yield it.
I pretty much just need to find that and then I think I can figure out where to go from there.
Maybe you’re right. I might try reposting this with an improved title; if I don’t get any other answers I think I may just have to go with that, unfortunately.