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

whats better, an "All in One" script or separate?

Asked by 2 years ago

im doing a game that have Race based morph, each race will have different skills and clothes that i set depending on race, datastore, Stats thing, spec thing depending on the Player.Name etc, so my question is, its better to i make all this in 1 big script, using something to separate it like coroutine or its better i separate all these things in 1 script each one? thinking in performance etc

0
It's up to you, it doesn't matter which you use, it is though frowned upon if you use a single script like I do, screw modules lol, just my unpopular opinion, don't bully me for it greatneil80 2647 — 2y

3 answers

Log in to vote
1
Answered by 2 years ago

The answer is both. I would take a look at single-script architecture, as it definitely makes organizing your game much easier then the alternative multi-script architecture. That said, you still shouldn't be stuffing all your code into 1 single script. You should be using module scripts to modularize your code and break it up into functional pieces which can be ran separately, but used together. The last thing you want is to be scrolling through a script with 6000+ lines of code to find the function you want to change.

0
hmm i never tried to use module scripts, maybe its my solution? how would i use for my case? i want make things(morph, give skills, give clothes) depending on the player Race Ariirael 15 — 2y
1
If you need help with module scripts, read this. https://developer.roblox.com/en-us/api-reference/class/ModuleScript Meeptey2 51 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

I'd think its better to seperate them so that scripts are more organized, like you have 600 lines of code in one script and for around each 60 lines (can be different, not the same) is a seperate task, so there will be 10 scripts for each task. (Extra: You can use bindable functions if you want the scripts to work in a order.)

0
hmmmmmmm yea, i got u, i think its more organized too, my doubt is: what if 5 scripts will run at same function? like "when a player join, then character join and then if race~=nil", how i can do for separate then for all work? it'll not crash? 5 scripts asking for the same "function" Ariirael 15 — 2y
0
Well I have no idea but you can try to use the events. User#47934 5 — 2y
Log in to vote
0
Answered by 2 years ago

For me, it depends on how complicated the thing you're trying to is. For example, if it's something like selecting a button and moving it, I'd make it one script as it's not that complicated. But for something like player morphs and data, I'd split it into 2 functions in a module script, then call it from the normal script as it's complicated enough where it would make some delicious code spaghetti.

0
yea, ill do data system, and depending on the race i'll give the player a morph, skills and clothes, now i do all these separate Ariirael 15 — 2y

Answer this question