Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] String is "too long" in loadstring?

Asked by 4 years ago
Edited 4 years ago

Hi, I have been working on a code obfuscation script, and the part where the code should go has a placeholder in it. When the plugin starts, I use gsub to replace the placeholder with the script and then run loadstring on the script. Only problem is, Despite the string only being 10895 characters long, it still gives me the string is too long error.

Also note: the script itself works without the loadstring. Only whilst using loadstring on it it decides to be too long

Plugin Script

if not plugin then return end

local random = plugin:GetSetting("RandomNum")

if not random then
    plugin:SetSetting("RandomNum",math.random())
end

local button=plugin:CreateToolbar("VM_Obfuscation"):CreateButton("Obfuscate Selection","Obfuscates Selected Scripts","")
print("Starting")
button.Click:Connect(function()
    local rrandom = Instance.new("StringValue")
    rrandom.Value = random
    rrandom.Parent = workspace.CurrentCamera

    button:SetActive(false)

    local s,m = pcall(function()
        for i,v in pairs(game.Selection:Get()) do
            if v:IsA("BaseScript") then
                print("\nObfuscating "..v.Name.."\n\n")
                local base = script.BASESCRIPT:Clone()
                base.Source = base.Source:gsub("lol data goes here i guess", v.Source)
                print(base.Source:len().."\n\n")
                loadstring(base.Source)()
--              base.Parent = script.Parent
--              base.Disabled = false
                repeat wait() until workspace:FindFirstChild("EncryptedScript"..random)
                base:Destroy()
                v.Source = workspace["EncryptedScript"..random].Value
                workspace["EncryptedScript"..random]:Destroy()
                print("\nObfuscated "..v.Name.."\n")
            end
        end
    end)
    if not s then
        warn("Couldn't obfuscate script! Send error message to developer of plugin: "..m)
    end
    rrandom:Destroy()
end)

Obfuscator's Code

https://pastebin.com/raw/xNvVpiM9 (It was too long for the site)

0
You can't use Source. That not work anymore. OnaKat 444 — 4y
0
@OnaKat, you can use Source in plugins or the command bar. In the code, you can notice that it is using the plugin API, so OP can use Source. saSlol2436 716 — 4y
0
depends. gui objects have a limit of 1024 characters. as for variables, the only limit is based on RAM (unless ROBLOX has limited it). it's very unlikely that they set a limit on it tho. namespace25 594 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Fixed Myself

Ad

Answer this question