I want to make a game that has classes that players can use. I’m learning about OOP and its implementation, and combining the power of metatables and module scripts for high-efficiency code. I want to migrate to using more advanced and efficient code structures, but I’m not sure if it’s possible and if it’s the best choice for my situation.
I have built a basic flight system using VectorForce, AlignOrientation and some animations, that I want to be able to reuse across multiple different classes by making it a module, but currently that flight script is a local script. This script is composed of functions that manipulate the VectorForce and AlignOrientation, both of which are stored inside the local script, as well as some functions that run animations based on velocity, and proximity to the ground. I like the way it works and looks, and would like to make it a module script so that I can re-use it with other animations in the future.
https://gyazo.com/fb54ea9fa14346fbd59a3d72cfc1d809
Similarly, I have a basic combat system that I want to be standard across all classes, and so I also want to make this script a module, but it’s also a local script. This script is just composed of handling a 5-attack basic attack string, so it loops through 5 different attack animations and then the server would handle the hitboxes and stuff like that.
https://gyazo.com/5a62745b2b4c030a6406dc89aa34347f
What I’m stuck on is that from my perspective, I can either make this flight system and combat system a module that runs on the client, which makes it exploitable, or put them on the server, which makes it laggy, and I just don’t have the development and coding experience to know how to compromise between the two. I am asking for insight or learning resources that can help me figure out how to organize my code so that it’s clean, reusable, and I can build in some protections against exploiting.
I have looked through many devforum posts and youtube videos about these topics, including metatables, module scripts, server-client communication, and anti-exploit measures, and I haven’t been able to piece the information together into a usable solution. I just don’t know where to go from here. I believe that OOP is a good way to organize my project, so that it will be easy to grow into a full game in the future, but I don’t think I understand enough about it to know if I should use it here, and so I’m asking for help. I’ll provide extra information if needed or asked for.