Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it bad practice to make singular scripts with various modules?

Asked by
bum5Br 97
2 years ago

Basically I have a game script on the ServerStorage that has tons of modules for various game logic ( Teams, timers, etc ). I'm now starting to work onto Player logic and I wanted to know if I should make a separate script or simply make it a module. Is this bad practice? Does it affect performance?

0
no it doesnt matter unless you wanna be organized one script would work just fine yazooonawad 0 — 2y

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
2 years ago

It's not performance what you should worry about, modules are very good because your code is connected and you have control over when something runs, for example you have 2 scripts and 1 module expects the second one to be loaded, if those were modules you could have a single script that will require and execute the first module and only then execute the second module easily and readably. Without modules you could use some kind of value which is not better. Different scripts they run in random order.

With different scripts there is no connection between them which makes few problems when using :BindToClose - what script is the main one, which should include it if multiple scripts require it?

You can use BindableEvents instead of modules, but that has a little issues which already affects something, it's not performance but BindableEvents after :Fire only execute on the next frame which might be even 1/40 seconds, that might be noticeable in some cases.

I made few demos that weren't for purpose of demonstrating good code but they are using modular structure with only single script (aka. single script architecture), all of them are open sourced on this profile, you can check them out maybe.

If you need some questions about modules I really can help with them since I always use them, you can DM me if far more info needed.

0
actually nvm it does not matter since script in ServerStorage won't execute anyway >wO imKirda 4491 — 2y
Ad

Answer this question