*String too long* error while making a ModuleScript with custom SourceCode

I’m making a plugin converting a Script into a ModuleScript, he is also editting the code to fix some errors in the code… The converted Scripts are used as constant data storage, it could store data for everythings like the start map or game’s Models…
The plugin works fine until it sets the source-code of a new ModuleScript.

It gives the error “String too long”
I’m stuck with that because I must absolutely get the ModuleScript working, I’ve nothing wich would work, I may be able to compress the script (because it’s made of >95% data) but not enought to hide this error.

1 Like

The limit is 200k characters and it dosen’t appear to exist any form of solution that isn’t super complicated, as far as I am aware.

You can find a thread about this issue here:

2 Likes

For me it’s very probblematic because there is no others way to save that!
The plugin actually edits the code but he also convert the Script into a ModuleScript!
Actually, I used Snap! to provide the script. I’m sorry but, Snap! is way more powerfull than ROBLOX (uh, Snap! may be slow to do the same things since it’s 2D based in JS)
I had no problem with string limits, anyway there isn’t any limits but I don’t understand ROBLOX, they must increase the limit, at least for the SourceCode of Scripts.
Instead of 200kc , let it to 16Mc or 4Gc . (c = character)
I wonder if we could do anything to make ROBLOX changing that? ROBLOX is stubborn and don’t want to listen anyone!

Now the plugin say that each times:
Successfully converted Test but the code is too long! (8613504 characters!)

1 Like

I mean, 200k characters is a large script. You could always split the data between multiple scripts if needed, then you would not reach the limit.

3 Likes

Considering the very small amount of people who even encounter this problem in the first place, the chance that Roblox is going to ever going to spend their resources resolving it is very low.

But then it gives me 44 scripts, wich, for my taste, is a lot since my game has only 8 scripts…
Anyway, Roblox’s garbadge is about… 135 scripts!
Okay, I think Roblox likes to make a lot of Scripts…

I think that making Scripts’s SourceCode bigger will allow better data Managing: less Scripts and less data, since hundreds of script using the same functions repetively is worse than one big Script. A big Script doesn’t need to transmit data between others scripts, since there isn’t any others!
But when a script needs to send data to another (for example, storing something on datastores) it would need a BindableEvent which will use a little bit of data because it is an Instance.

Also since they use 135 Core-Scripts, I don’t think they care about their resources, and anyway, they are very greedy when we talk about money, so I agree that they don’t need to care about their resources…

As I say, removing the string length limit will not use more resources, and anyway, I think they have a lot of free space.

If you are desperate, you can write a bot/api that uploads your source as a model to roblox and then returns the model id for your code to insert it via InsertService.
I don’t think there is any other workaround to this problem.

1 Like

Is there a way to convert a .lua or .txt file directly into a ModuleScript?

I know this is old, but did you ever solve this issue. I have the same now, with my plugin i have made to sync files externally for use with external editor.

No there is no way to solve it, 200k characters is a standard size limit for strings.
(Roblox wouldn’t be interested to remove the limit either.)

I understand how you feel, I’ve had the same experience.

1 Like

In the future, don’t necro posts - private message OP directly