How can I make a custom listenable?

Some people mentioned there might be a way to create my own listenables and i wanted to know if there was a way i didnt know about.

Hey, so I’ve made this script which I’ve been using for a month and it doesn’t seem to fail me, maybe you can try it :person_shrugging:

Tried to use something similar to this code, it works fine when everthing is in one script but once I attempt to use my subscribable class it start throwing “Can’t access a function from a preceding type” errors.

Yep I actually posted an issue about this but it didn’t got any attention, I don’t understand how I didn’t get any upvotes, looks like a major issue to me :person_shrugging:

2 Likes

Yeah I have gotten this multiple times with generics. My current solution is to wrap the subscribable in a class like this (make sure to place this class in the same script as my_subscribable):

my_subscribable_agent<public> := class:
    Subscribable<public> : my_subscribable(agent) = my__subscribable(agent){}

And then you can just use the Subscribable object in that class, not ideal having to create those extra classes but it’s okay for now I guess.

2 Likes

thanks fenzy! i did end up using your method, but we would like to eventually move out of tasks tbh.

2 Likes

Me too my dude, me too :slight_smile: