Issues with modules

My issue at hand is that, I guess, I just don’t know how to use modules properly.

I’m trying to create a combat system usable by both Enemy NPCs and Players. I got it working with players first and now I’m having trouble getting it to work with enemies.

I created the module with variables outside of functions since I couldn’t have them within functions, and I still wanted to contain everything within the module. I then learned pretty quickly that this was an issue due to modules only existing once in the server environment as opposed to separately on each client. This means the variable updates would happen to every NPC.

Would it be possible to have the combat module be self contained but work in a server environment with NPCs? If so how would I achieve this?

Module Code: https://gist.github.com/BuniBun/c0e6ed29d3f0f55eb45cc402101c6f2a

Any improvements I could make all around would be very welcome suggestions as I’m aware of how poorly this has been made and I’d like to improve it greatly. Also the way I handle animations is a mess and I’m not sure of how I should go about doing this / make it cleaner