print("--//Made with Zfuscator\\--")
-- Define the Roblox-Compatible Obfuscator Function
function obfuscate(script)
-- Helper Functions
local function generateRandomName()
return "var" .. math.random(100000, 999999)
end
local function xorEncryptDecrypt(str, key)
local encrypted = {}
for i = 1, #str do
local c = str:sub(i, i)
local enc = string.char(string.byte(c) ~ key)
table.insert(encrypted, enc)
end
return table.concat(encrypted)
end
local function encryptString(str, key)
return xorEncryptDecrypt(str, key)
end
local function decryptString(str, key)
return xorEncryptDecrypt(str, key)
end
local function obfuscateCode(code)
-- Variable Renaming
local renamed = {}
local counter = 0
code = code:gsub("%f[%a_](%w+)%f[^%w_]", function(var)
if not renamed[var] then
counter = counter + 1
renamed[var] = generateRandomName()
end
return renamed[var]
end)
-- String Encryption
code = code:gsub('"(.-)"', function(str)
local key = math.random(1, 255)
local encryptedStr = encryptString(str, key)
return '"..decryptString("' .. encryptedStr .. '", ' .. key .. ').."'
end)
-- Add Decryption Function
code = [[
local function decryptString(str, key)
local decrypted = {}
for i = 1, #str do
local c = str:sub(i, i)
local enc = string.char(string.byte(c) ~ key)
table.insert(decrypted, enc)
end
return table.concat(decrypted)
end
]] .. code
-- Flatten Code
code = code:gsub("%s+", "") -- Remove whitespace
code = code:gsub("\n", "") -- Remove newlines
code = code:gsub("endend", "end") -- Flatten end statements
return code
end
-- Obfuscate the Provided Script
return obfuscateCode(script)
end
-- Your Lua script to be obfuscated
local myScript = [[
Script here!
]]
-- Obfuscate the Script
local obfuscatedScript = obfuscate(myScript)
-- Output the Obfuscated Script
print(obfuscatedScript)
To embed this project on your website, copy the following code and paste it into your website's HTML: