How can I make a custom listenable?

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.