How can I compartmentalize with module scripts without having long lists of arguments for variables?

Hey, so I’m trying to make a system for abilities and every ability needs to have this generic code for reading inputs and firing functions for their moves. The problem with this though is that if I have 10 abilities and I change the structure on how abilities work, I have to edit every single script. So I’m trying to move the generic functionality all to module scripts to then require them.

The issue with this is some of these functions require a lot of variables the module script doesn’t have. I can add arguments and parameters for these module scripts but that’d mean I have to write out something like

module.doFunction(player, position, sound, rotation, length, size, counter, state, animation, this, that)

I thought about making a table with variables and just sending it a table full of variables it may or may not need, but I was wondering if there’s an easier way to give it scope of the script’s variables or if there’s a better way to structure this in general.

2 Likes

you can use a custom type for this. i’m not exactly sure what you mean but from my experience i think custom types would be the best for you

1 Like