
Dependencies initialized by the "main" script then depend on other dependencies, while making sure cyclic dependencies do not happen. That script is responsible for the initialization process. You should only have one script for each end - the server and the client. Sadly, there isn't a proper repository system nor a standard on how modules should be written and distributed.
THOSE WHO REMAIN ROBLOX SCRIPT CODE
One of my biggest criticism towards Roblox as a game development platform is how it doesn't push people to write code like it'd be done in the "real world". Services like ServerScriptService and StarterPlayer are great places to store scripts.īe sure to upvote/accept if I answered your question! Keep your scripts in the same directory: Nobody wants to search for your script, make it easily accessible.Write the function (or class) inside it, then require it from within the script near the top.

Nobody wants to scroll through 350 lines of definitions! Use modules for this. Again, talking about modules, almost never define functions from within normal scripts: Doing so greatly increases your script's length, therefore impacting readability.If you don't know how modules work, learn them. Utilize modules (or ModuleScripts): Modules allow you to store code from within a container to be used later.It allows you to explain your code in plain English rather than wasting precious minutes rooting through your code. Properly comment your code: Tell the reader (even if it's you in 2 months) what this or that does.The explicit point here is to remain organized, and Roblox provides you with a few tools to do so. Never write sloppy code and expect to be able to read it 2 months later you won't. This allows for easy debugging in the future. Would you put that part of code into the main script, or use a different script and make those scripts communicate with eachother, if so then how.ĭoes a major game like Phantom Forces for example, which definitely has lots of scripting handle majority of stuff in one big script, or rather separates them in multiple ones, ones that need to communicate with eachother.įor proper game development, readability is key. If so, how would you make all those scripts communicate with eachother, possibly making one big main script and the rest just modulescripts?įor example, you have a script that holds a table with player data, and you would need to reuse, have access or change that data in a script or part of code that could for example handle a shop. What would be the best way to structure scripts on a major project, trying to make as much things as possible in one big script, or making multiple scripts each doing something else.

Hello, this is rather a general game development question, would ask this on devforum if I could bother getting accepted in there.
