Is it a bad idea for a experience to rely on a single 'core' script?

Would it be a bad idea for a Roblox experience rely on a single script to execute all the game server-sided functions?

Edited, just fixed Roblox capitalization and a typo in ‘experience’.

Yes, yes it is, please do not do this.

4 Likes

Solved, but what major consequences can it cause to my experience?

A massive performance decrease depending on how large the game is

1 Like

Scripts can become monumental and large, making readability a massive concern (even if it’s just yourself scripting it). Readability problems can lend over to debugging issues where it’s harder to find the source of the problem. You are also shooting yourself in the foot once you develop your game enough as you realize that you now are locked into this workflow of hard coding pretty much everything. Building features is insanely difficult since nothing is modularized.


Source: Me who built their game using a single script. Had to take a few months converting my game to use “multiple” scripts since it was becoming too difficult to maintain. Please take the time to look at frameworks or ways to modularized your game; your future you will thank you.

9 Likes

FYI: basically every major game off Roblox runs this way. You always want a single predictable entry point for code to start up your systems and then you can work from there. It is better both in terms of organisation and technicals to think in terms of a single “core” script and it helps you prepare if you want to take your development off Roblox.

Current marked solution (post 2) doesn’t explain why it’s bad. I encourage that user to try getting into a serious project with a framework and compare it to their experience without it over time. It is much easier to build features and it helps get into an industry-standard mindset.

3 Likes

I see people saying it’s bad but the truth is it really does not matter. I personally believe it better to have a single server entry point (and possibly a single client entry point depending on what you’re doing). This does not mean you should be writing all your code in a single script though. You should take advantage of ModuleScripts to properly organize your code and keep everything working as intended. If you’re interested in putting this into practice you might want to check out my game framework Volt which is built around this ideology.

1 Like

Responding to both colbert2677 and AstrealDev, I will admit that in hindsight it might not have been the best idea to be so vague. I would like to clear up some things about what I have said. The way I interpreted this question was “should I include everything for my game (scripting wise) within one script”— which in my opinion, answering with “yes you should do this” would be doing more harm than saying you shouldn’t. It’s definitely my fault for responding so vaguely, so I apologize for that.

It’s really a double edged sword, and I wanted to avoid getting in arguments with other developers about what they prefer, or what they think is right. Which is also why I’m going to leave this post as my last contribution to the discussion. This reply is either going to show what’s right, or what’s utterly wrong. And while I definitely don’t like being the example for what NOT to do, if that ends up being the case then at least it’s still providing information to those who read this post.

There are definitely case scenarios where using one core script can be beneficial, don’t get me wrong. However, knowing the majority of developers on Roblox who are inexperienced, if they were to follow this methodology there is a pretty high chance for introduction of poor scripting practices. One of the major ones is organization and efficient usage of code. It worries me the amount of people who have never used module scripts, replicated storage, or even asynchronous events for that matter. Hence why I made the response I did, in regards to the inexperienced.

Does that mean you should never put everything in one script? No.
Does that mean you should always put everything in multiple scripts? No.

Giving such a set in stone yes/no answer to this question was stupid on my part, as there are multiple answers.

In my opinion, however, I think generally it is a safe thing to start out using multiple scripts- build up your knowledge as a developer, and then consider going for a core script. Learning the fundamentals of referencing external objects, module scripts, events, and asynchronous programming are still important, its always a good idea to at least know how to work in an environment with multiple scripts.

At the end of the day, it’s really up to the developer and how they want to do it. So making my previous post a “solution” is probably not the best idea, as it isn’t a solution. Sorry for the confusion.

2 Likes

Strange answers but I believe it really depends on the game you are making. If you were making one of those short horror story games for example like the nightshift experience alot of the code would be in one script to keep things in order you know from start to finish, if you’re making a game like arsenal though with tons of mechanics and not in a story based pattern then I think you would have multiple scripts obviously.