I finished making a single gun tool and now im wondering what the best way to make it OOP (i think this counts) is. should I put a module script under each gun which has modifiers and requires the main gun system? should i scan each tool in the main gun script for a gun attribute and check int values under the tool for differences? something else?
#best way to make a gun system
1 messages · Page 1 of 1 (latest)
if you're using OOP you're gonna want to structure it in a way that requires as few scripts as possible
per gun*
ideally just 1 module script for each gun
the way you want to structure the gun system if you want to use OOP is to make a whole ton of different assets you can just slap together in a modulescript with a main function for both client and server that is called when the tool is first given to the player
So instead of hardcoding things like shotguns you just have a bunch of reusable code that can be used to make a shotgun
Or one central module storing all of the weapons and their traits, but yeah
probably much more secure from exploits but can make it annoying to edit
generally though just structure it in a way where you don't need to write more than 150 lines per gun
my old system would take upwards of 450 lines per gun, it was awful
Neither are more or less secure from exploits if done properly
This depends, like if you want just a base class for the gun and then be able to code the functionality of it not just modify its traits
i got both
thanks
how would the main gun module (in replicated storage or whatever) detect guns though?
would it check for attributes or something
it doesn't
you just add the module to the tool, which has init/main functions (whatever you wanna call them) that does all the gun building
just you need a local and server script to call them