Make my MainScript Safer from Exploits

Should I Migrate my Main Script that handles Rounds, Round Time, Round Rewards, Maps, Players Spawns, giving Round Items. That Would Use:

require(ASSET_NUMBER)

And So On.

2 Likes

If I am understanding the question correctly, this is about the security of having the script in the game compared to using require. Security should be the same if both cases are on the server. A problem you may run into is the main script being out of sync if a new server comes up with either the place not updated or the module script not being updated, leading to seemingly-random errors when updating the game.

2 Likes

Yes, the MainScript is in ServerScriptService So Security is the same but Module might make the MainScript Error when using require?

An error could occur in 2 cases:

  1. The ModuleScript is unable to load. This could be due to a network error (not your fault) or not naming the script correctly (would be your fault, but should get an error pointing to that problem).
  2. The ModuleScript is intended for different versions of the server. If you were to have a delay between updating the game and updating the model, servers created during that time will have a mismatch and could lead to errors depending on how the instances are set up.

You will also want to develop with the option to use a local version because constantly uploading to Roblox will drastically decrease the speed of development and make testing harder.

1 Like

Would i just Copy and Paste my MainScript Code into a module script? Is it that easy to use module scripts?

Theoretically yes if the game already uses ModuleScripts. They do need to be loaded using require in an existing Script and the ModuleScripts need to return exactly 1 value.

This strongly depends on the code’s architecture and how it is published. If the goal is to make it safer from exploiters, then it doesn’t accomplish anything while making publishing slower. It may be worth creating a separate thread reading ModuleScript game architecture since this thread is about just moving code to ModuleScripts.