The title says it all.
How Many Lines of Code can Roblox Studio Withstand?
1 answer
Using the follow snippet, I was able to determine that the maximum length of a string that can be stored in the script's source is 200 000:
local source = ""
for i = 1, 199999, 1 do
source = source .. "\n"
end
Instance.new("Script", game.Workspace).Source = source
######Source has PluginSecurity, meaning it cannot be used in scripts, but is usable in the command bar and plugins.
Note that is independent from the number of lines and rather dependent upon the number of characters in the string stored in Source.
However, if you attempt to add more lines to the script this generates, you will be able to. I'm guessing they format the source string to ignore all unnecessary whitespace. But I'm not sure where the unmodified file would be stored at (or even how it is stored), so I can't test the limits for that.
So essentially you have a limit of 200 000 characters of actual runnable code.
1 comment
200,000 Characters? Or Lines of Code? or Characters Per line?
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
I don't think there would be a limit, nor would I think any developer on ROBLOX would be using any lines more than a few hundred. A script would probably just lag while being edited if it had thousands of lines of code and opening studio might lag a bit with a file size increase.
I've had a script have around 3k lines of code in it at once and it ran fine. Studio handles large text files easily, it's running them that can be an issue.
I have two scripts, one being 489 lines of code, while the other 602 lines of code. Is that bad? If so, can I break it into smaller scripts and thus making it less laggy?
I think it could easily handle tens of thousands of lines of code. It's processing it all that might be an issue. Splitting into multiple scripts creates multiple threads, which help on a many-core computer. Coroutines also split it into multiple threads while keeping the code a bit more readable depending on the purpose of it. On a single or dual core, it's better to have fewer threads.
It all depends on your computer's processors. ROBLOX Studio can run THOUSANDS of lines of code, but if you've got a slow processor, then you've got a slow game.