Say I’m scripting a weapon that has multiple attacks, some ranged, others close quarters. Is it advisable to have one script for each individual attack in the serverscriptservice or should I have one script that does all the work?
Have 1 script that does all the work. If you really want multiple scripts just use coroutines > or use a module script which is way more efficient for bigger scripts.
Personally I would do one whole script so you can call everything with the functions you may need in one script and it would be more organized to find it all in one script rather then having many different one’s. I feel if you comment out correctly it can also make it a lot easier to find certain things rather then having to open each separately.
I see, thank you both for the input.
As for the local script, do I fire all events from one script too?
All is up to your preference and organization. I use one server script and one client script to be the cores of whatever I am making. They will be very simple and the majority of my code will be left to modules that allow the client and server to share if needed and organized into multiple modules depending on the situation. For your weapon I would create a module for settings and one for the attack functions and associated checks/math. The client/server scripts will just handle when to activate the functions.
I always use 1 local script for my games if I need to diversify things I’ll probably throw some modules inside and do things from there. Of course it’s personal preference there is no right or wrong if you can be super efficient with 30 scripts the same way I can with 1 then there’s really no reason to change. But personally I would use 1 local script