RobloxStateMachine - A Simple State Machine implementation

It really depends on however you wish to approach this, I also have multiple NPCs in my game each using their own state machine. I pretty much have a main file to manage the NPCs and fire events to it whenever it is necessary.

Instead of bindable events you can use the Signal library to keep events 100% in code Signal | RbxUtil (sleitnick.github.io)

thanks for the rbx util tip

can u give an example of how we use Transition:Extend() please

I understand the basics of inheritance, as it essentially creates a subclass, but I have trouble figuring out how to benefit from it when it comes to npc behaviours

I’ve tried to use this for a player state machine.

However when I try to create a state machine in a local script I keep getting errors when trying to load states. It keeps telling me that it’s iterate over nil values.