I like the answer that @congrajhulashions wrote; however, I’d like to go into more detail on how I did a similar thing, but far more secure.
First off, I’d like to say that it doesn’t matter which side of the third-party module debate you were, a solution to private code is needed, and always will be.
For hosting, I highly recommend Firebase, it scales automatically and does much of the work for you.
Just like @congrajhulashions said, pretty much the best way, without it getting really complicated, is to download the code from your server. Now, this is where stuff gets messy if not appropriately secured. This is where the Roblox API comes in! Now, when you connect to a Roblox server, you need its IP. Otherwise, how do you connect to it?
Roblox has an API for joining a server. If used right, this API will return the IP of the server that you put in the request. Compare that to the IP of the request and you know if that request is from a real Roblox server (after taking measures to prevent IP spoofing). Awesome, right? Now, I’m not going to spoon feed you this API, but I’ll point you in the right direction.
Once you know that the request is really from Roblox, you can check your whitelist to see if that place (or owner) is supposed to use your script. If so, send the script to the game. Here there are things you can do to secure it more, but once again, I’m not here to spoon feed you.
Once the game receives the script, you can run it either using the official Roblox loadstring, or a custom one. The official loadstring will probably be more reliable and faster; however, using a custom one means that the game doesn’t need to have loadstring enabled. I use the one from that is inside the Adonis module (search up Adonis in the toolbox to get the main module and then take the Loadstring
module from it).
I am currently working on a site called the Marketplace. It can do everything mentioned above and far more. You can read more about it here and here.
Good luck with your project!