#Module scripts

1 messages · Page 1 of 1 (latest)

hollow sandal
#

I'm making a game and I wonder if everything that I do server-sided should have a module script. Instead of writing, let's say, functions in the server script, I have modules.

copper patio
#

At the end of the day all that matters is that you get the project out. If it becomes an organizational headache it'd probably make more sense to just accept small redundancies and keep stuff isolated

#

Nothing wrong with spreading code out into modules but there's really no specific reason to do so unless you really have a clear purpose otherwise you might end up spaghetti coding a bunch of shit that could have been isolated

#

It depends though. Like I'll usually make stuff like gameplay components of a custom CharacterController into a module, or if there is multiple keybind states that can be toggled I'd probably have an InputMode module to make it the hub of that functionality

hollow sandal
#

If I have userinputservice keybinds in client

#

Should I use modulescript to control them=

copper patio
#

Maybe. It depends on how complex your project is gonna be

#

If you're making a pretty complex inventory game or even if you have different input states for like spectate versus gameplay then yeah probably

hollow sandal
#

a sports game

#

?

copper patio
#

If you feel like it would help how you design the code then for sure

#

Really you should be asking yourself what is the utility of putting this code here

#

and if it doesn't really have a lot of justification then maybe think about where it would make the most sense or if going through the extra trouble is even worth the effort y'knaw mean

hollow sandal
#

does it have any performance benefits?

copper patio
#

It can depending on the situation for sure. Redundant code can be a huge problem

#

But like I said, you wanna keep yourself focused on actually getting shit done

#

Hyper optimization will kill your progress fast

hollow sandal
#

hmm alr

#

but since my whole game is basically done

#

i have like 3 diff scripts lol

#

1 for datastore

#

1 for round system

#

1 for mechanims

copper patio
#

If it's basically done I don't see the point in breaking code up

calm igloo
#

Think about module like an external function, if you throw item away in your room it’s cleaner, but if you have them always in there it’s more fast to get it

#

So module doesn’t really create any performance benefit but cleaner code in exchange for some tiny performance change