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)