Unable to store more than 16,385 characters in a TextBox

I designed a system to allow players to generate “codes” in a Roblox Studio plugin to import custom content into my game. These “codes” are large JSON formatted strings containing Part data. [[Size,CFrame,Color,Etc]]

The problem with this, is a TextBox | Documentation - Roblox Creator Hub cannot contain more than 16,385 characters. (This isn’t mentioned anywhere on the Wiki. That’s why I added the client-bugs tag) There is also no way to access the clipboard to extract the string in question. There is no way to input more than 16,385 characters.
Normally this isn’t a problem, but in this rare case it becomes a very big issue. (codes are generally 300K+)

I’ve looked into compression algorithms to try to fit as much as I can but a compression ratio of that magnitude is outright impossible.

I have been unable to find any workaround to this issue. If there is anything I should be aware of, please let me know in the replies!

Thanks for letting me in the DevForum, finally :slight_smile:

2 Likes

Have you considered string compression? here’s a resource but I can’t guarantee you it would be able to compress it to be less than the textbox limit.

(codes are generally 300K+) I’ve looked into compression algorithms to try to fit as much as I can but a compression ratio of that magnitude is outright impossible.

i didn’t mention that 300K was just for “A Happy Home in Robloxia”
a very simple build

EDIT: I looked at zlib, it claims it can turn ~300K into 50K characters, roughly
That’s still over 4X more than a TextBox can support, for a very simple build

1 Like

It turned out to be pretty useful.

I resorted to a mix of this library, and pastebin’s Http API to save and load the data
WOW that’s hacky
but at least it works! thanks for the resource!

2 Likes

I THINK deflate is better? I guess it just depends on what you’re saving, when I was testing it it worked better with deflate, anyways gl.

The provided library above contains both zlib, and deflate compression.
I found deflate yeilded the best results, with astronomical compression ratios of around 80%

it’s like a magic module, anyone looking to compress text, this is your best solution.
it does come with it’s drawbacks. you can’t copy/paste the text after it is compressed, as it uses the entire set of 256 ascii characters, including control characters that are not meant to be held in the clipboard, malforming the data. The string itself can be preserved through Http api (ex. Pastebin). Datastores can’t store these “malformed characters” though, as far as I know.

1 Like