Script works if raw code, but returning the script from a web server doesn't work

I want to execute a script from a web server that is around 850 lines, it works if it is a raw script in-game, but if I return the code from the web server it doesn’t work. If I have the code in studio, it works perfectly fine. If I return the code from a nodejs web server, it doesn’t work. I was thinking there was a character limitation to a GET request. The developer hub did not say anything about this. If I copy and paste the code from the web server (in browser and code is not formatted) into a studio script, it works perfectly. Whereas if I call loadstring on it all it tells me is “attempt to call a nil value”. If I tried printing the code to output, it shows some of the script but at some point cuts off to say I have 27,000 characters and the limit is 16,000 characters. Is there a fix for this. Is this hardcoded into httpservice? And if it is hardcoded, can I bypass this limitation?

I don’t think that the issue is with HttpService, as some scripts use it to retrieve API dumps (which are very long). Have you tried running a script in the command bar that gets the script from your API through HttpService and puts it into the script using its Source property?

That’s weird because if I copy and paste it from my browser it is perfect, but if I set with script.Source this happens:


It’s only the kick parts in my script that have been malformed like this for some reason, the rest of the code is fine.

Do you know what is happening?

That’s probably because of the escape characters. Try replacing \n with \\n in the code in your web server.

Why do you want to import code from a web server, if I may ask? If you are doing this for security, it isn’t necessary, since anyone exploiting the game or downloading a copy wouldn’t be able to see the source of server scripts anyway.

Why not use ModuleScripts on Roblox and require them by ID?