Script Decompiler
Key RequiredUniversal

Script Decompiler

Universal ScriptXimmy1234Ximmy1234 1.2K views 225 executesUpdated May 1, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•356 lines (11152 chars)
local scanDelay = 0.05
local decompileTimeout = 1

local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")

local gameName = "UnknownGame"
pcall(function()
	gameName = game:GetService("MarketplaceService"):GetProductInfoAsync(game.PlaceId).Name
end)

local function sanitize(name)
	return string.gsub(tostring(name), '[<>:"/\\|?*%c]', "_"):sub(1, 50)
end

local FOLDER_NAME = "decompile_" .. sanitize(gameName) .. "_" .. tostring(game.PlaceId) .. "_" .. HttpService:GenerateGUID(false):sub(1, 6)
local BRAND = "Ximmy's Sexy Script Decompiler"

local hasDecompiler = false
pcall(function()
	if decompile then
		local t = Instance.new("LocalScript")
		t.Parent = game:GetService("ReplicatedStorage")
		local ok, r = pcall(decompile, t)
		t:Destroy()
		hasDecompiler = ok and r ~= nil
	end
end)

local getgenv = getgenv or function() return _G end
local env = getgenv()

local function makeGui()
	local gui = Instance.new("ScreenGui")
	gui.ResetOnSpawn = false
	gui.DisplayOrder = 2e9
	local ok = false
	pcall(function()
		local f = env.gethui or function() return game:GetService("CoreGui") end
		gui.Parent = f()
		ok = true
	end)
	if not ok then
		pcall(function()
			gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui")
		end)
	end
	return gui
end

if not hasDecompiler then
	local errGui = makeGui()
	errGui.Name = "DecompilerError"
	local f = Instance.new("Frame")
	f.Size = UDim2.new(0.45, 0, 0, 80)
	f.Position = UDim2.new(0.275, 0, 0, 10)
	f.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
	f.BorderSizePixel = 0
	f.Parent = errGui
	Instance.new("UICorner", f).CornerRadius = UDim.new(0, 8)
	local p = Instance.new("UIPadding", f)
	p.PaddingLeft = UDim.new(0, 12)
	p.PaddingRight = UDim.new(0, 12)
	p.PaddingTop = UDim.new(0, 10)
	local t = Instance.new("TextLabel", f)
	t.Size = UDim2.new(1, 0, 0, 22)
	t.Position = UDim2.new(0, 0, 0, 0)
	t.BackgroundTransparency = 1
	t.TextColor3 = Color3.fromRGB(255, 80, 80)
	t.TextScaled = true
	t.Font = Enum.Font.GothamBold
	t.TextXAlignment = Enum.TextXAlignment.Left
	t.Text = "No Decompiler Available"
	local m = Instance.new("TextLabel", f)
	m.Size = UDim2.new(1, 0, 0, 36)
	m.Position = UDim2.new(0, 0, 0, 28)
	m.BackgroundTransparency = 1
	m.TextColor3 = Color3.fromRGB(200, 200, 200)
	m.TextScaled = true
	m.Font = Enum.Font.Gotham
	m.TextXAlignment = Enum.TextXAlignment.Left
	m.TextWrapped = true
	m.Text = "Your executor does not have a working decompiler.\nPlease use an executor that supports decompiling."
	task.wait(8)
	pcall(function() errGui:Destroy() end)
	return
end

local function safeDecompile(scr)
	local output = "-- Failed or empty output"
	local finished = false
	task.spawn(function()
		local ok, result = pcall(decompile, scr)
		output = (ok and result and result ~= "") and result or "-- Failed or empty output"
		finished = true
	end)
	local waited = 0
	while not finished and waited < decompileTimeout do
		task.wait(0.1)
		waited = waited + 0.1
	end
	if not finished then
		output = "-- Timed out after " .. decompileTimeout .. "s"
	end
	return output
end

local createdDirs = {}
local function ensureDir(path)
	if createdDirs[path] then return end
	createdDirs[path] = true
	local current = ""
	for part in string.gmatch(path, "[^/]+") do
		current = current == "" and part or (current .. "/" .. part)
		if not createdDirs[current] then
			createdDirs[current] = true
			pcall(env.makefolder or makefolder, current)
		end
	end
end

local function buildScriptData(scr)
	local parts = {}
	local cur = scr.Parent
	while cur and cur ~= game do
		table.insert(parts, 1, sanitize(cur.Name))
		cur = cur.Parent
	end
	local ext = scr:IsA("LocalScript") and ".local.lua"
		or scr:IsA("ModuleScript") and ".module.lua"
		or ".server.lua"
	local dir = FOLDER_NAME .. "/" .. table.concat(parts, "/")
	local path = dir .. "/" .. sanitize(scr.Name) .. ext
	return { scr = scr, dir = dir, path = path }
end

local function isCoreScript(scr)
	local success, isDescendant = pcall(function()
		return scr:IsDescendantOf(game:GetService("CoreGui")) or scr:IsDescendantOf(game:GetService("CorePackages"))
	end)
	return success and isDescendant
end

local function collectAllScripts()
	local found = {}
	for _, obj in ipairs(game:GetDescendants()) do
		if obj:IsA("LuaSourceContainer") and not isCoreScript(obj) then
			table.insert(found, obj)
		end
	end
	return found
end

local screenGui = makeGui()
screenGui.Name = "DecompilerGui"
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.5, 0, 0, 165)
frame.Position = UDim2.new(0.25, 0, 0, 10)
frame.AnchorPoint = Vector2.new(0, 0)
frame.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
frame.BorderSizePixel = 0
frame.Parent = screenGui
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 8)
local pad = Instance.new("UIPadding", frame)
pad.PaddingLeft = UDim.new(0, 10)
pad.PaddingRight = UDim.new(0, 10)
pad.PaddingTop = UDim.new(0, 8)

local titleLabel = Instance.new("TextLabel", frame)
titleLabel.Size = UDim2.new(1, 0, 0, 20)
titleLabel.Position = UDim2.new(0, 0, 0, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.TextColor3 = Color3.fromRGB(255, 200, 50)
titleLabel.TextScaled = true
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Text = BRAND .. " - " .. gameName

local statusLabel = Instance.new("TextLabel", frame)
statusLabel.Size = UDim2.new(1, 0, 0, 18)
statusLabel.Position = UDim2.new(0, 0, 0, 24)
statusLabel.BackgroundTransparency = 1
statusLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
statusLabel.TextScaled = true
statusLabel.Font = Enum.Font.Gotham
statusLabel.TextXAlignment = Enum.TextXAlignment.Left
statusLabel.Text = "Scanning..."

local scriptLabel = Instance.new("TextLabel", frame)
scriptLabel.Size = UDim2.new(1, 0, 0, 16)
scriptLabel.Position = UDim2.new(0, 0, 0, 46)
scriptLabel.BackgroundTransparency = 1
scriptLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
scriptLabel.TextScaled = true
scriptLabel.Font = Enum.Font.Code
scriptLabel.TextXAlignment = Enum.TextXAlignment.Left
scriptLabel.Text = ""

local barBg = Instance.new("Frame", frame)
barBg.Size = UDim2.new(1, 0, 0, 14)
barBg.Position = UDim2.new(0, 0, 0, 68)
barBg.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
barBg.BorderSizePixel = 0
Instance.new("UICorner", barBg).CornerRadius = UDim.new(0, 4)

local barFill = Instance.new("Frame", barBg)
barFill.Size = UDim2.new(0, 0, 1, 0)
barFill.BackgroundColor3 = Color3.fromRGB(255, 200, 50)
barFill.BorderSizePixel = 0
Instance.new("UICorner", barFill).CornerRadius = UDim.new(0, 4)

local etaLabel = Instance.new("TextLabel", frame)
etaLabel.Size = UDim2.new(1, 0, 0, 14)
etaLabel.Position = UDim2.new(0, 0, 0, 87)
etaLabel.BackgroundTransparency = 1
etaLabel.TextColor3 = Color3.fromRGB(120, 120, 120)
etaLabel.TextScaled = true
etaLabel.Font = Enum.Font.Gotham
etaLabel.TextXAlignment = Enum.TextXAlignment.Left
etaLabel.Text = ""

local statsLabel = Instance.new("TextLabel", frame)
statsLabel.Size = UDim2.new(1, 0, 0, 14)
statsLabel.Position = UDim2.new(0, 0, 0, 105)
statsLabel.BackgroundTransparency = 1
statsLabel.TextColor3 = Color3.fromRGB(180, 180, 180)
statsLabel.TextScaled = true
statsLabel.Font = Enum.Font.GothamBold
statsLabel.TextXAlignment = Enum.TextXAlignment.Left
statsLabel.Text = "Passed: 0  |  Failed: 0"

local savedLabel = Instance.new("TextLabel", frame)
savedLabel.Size = UDim2.new(1, 0, 0, 14)
savedLabel.Position = UDim2.new(0, 0, 0, 123)
savedLabel.BackgroundTransparency = 1
savedLabel.TextColor3 = Color3.fromRGB(80, 200, 255)
savedLabel.TextScaled = true
savedLabel.Font = Enum.Font.Gotham
savedLabel.TextXAlignment = Enum.TextXAlignment.Left
savedLabel.Text = "Folder: " .. FOLDER_NAME

local passedCount = 0
local failedCount = 0
local totalKnownScripts = 0

local function updateStats()
	statsLabel.Text = string.format("Passed: %d  |  Failed: %d", passedCount, failedCount)
	local ratio = passedCount / math.max(passedCount + failedCount, 1)
	statsLabel.TextColor3 = Color3.fromRGB(math.floor(255 * (1 - ratio)), math.floor(255 * ratio), 80)
end

local lastGuiUpdate = 0
local function updateGui(scriptPath, elapsed, eta, finished)
	local now = os.clock()
	local processedTotal = passedCount + failedCount
	if not finished and (now - lastGuiUpdate < 0.3) and (processedTotal % 5 ~= 0) then
		return
	end
	lastGuiUpdate = now

	local percent = totalKnownScripts > 0 and math.floor((processedTotal / totalKnownScripts) * 100) or 0
	barFill.Size = UDim2.new(totalKnownScripts > 0 and (processedTotal / totalKnownScripts) or 0, 0, 1, 0)
	statusLabel.Text = string.format("Scripts: %d / %d  (%d%%)", processedTotal, totalKnownScripts, percent)
	scriptLabel.Text = scriptPath or ""

	if finished then
		etaLabel.Text = string.format("Took %ds | Done!", elapsed)
		titleLabel.TextColor3 = Color3.fromRGB(50, 255, 100)
		barFill.BackgroundColor3 = Color3.fromRGB(50, 255, 100)
		savedLabel.Text = "Saved: " .. FOLDER_NAME
	else
		etaLabel.Text = string.format("Elapsed: %ds | ETA: ~%ds", elapsed, eta)
	end
end

local processed = {}

local function processScriptList(scriptList, startTime)
	for i, scr in ipairs(scriptList) do
		if scanDelay > 0 then
			task.wait(scanDelay)
		else
			task.wait()
		end

		if not processed[scr] then
			processed[scr] = true

			local fullName = ""
			pcall(function() fullName = scr:GetFullName() end)

			local ok, err = pcall(function()
				if not scr or not scr.Parent then
					error("destroyed")
				end

				local data = buildScriptData(scr)
				local rawSource = safeDecompile(scr)
				local source = "-- " .. BRAND .. "\n-- Original: " .. fullName .. "\n\n" .. rawSource

				ensureDir(data.dir)
				local written = pcall(env.writefile or writefile, data.path, source)
				if not written then
					local flatPath = FOLDER_NAME .. "/" .. #processed .. "_" .. sanitize(scr.Name) .. ".lua"
					ensureDir(FOLDER_NAME)
					pcall(env.writefile or writefile, flatPath, source)
				end
			end)

			if ok then
				passedCount = passedCount + 1
			else
				failedCount = failedCount + 1
				warn("[Decompiler] FAILED " .. fullName .. ": " .. tostring(err))
			end
			updateStats()

			local processedTotal = passedCount + failedCount
			local elapsed = math.floor(os.clock() - startTime)
			local rate = processedTotal / math.max(os.clock() - startTime, 0.001)
			local remaining = totalKnownScripts - processedTotal
			local eta = math.floor(remaining / math.max(rate, 0.001))
			updateGui(fullName, elapsed, eta, false)
		end
	end
end

local startTime = os.clock()
local round = 1
local MAX_ROUNDS = 5

repeat
	local scripts = collectAllScripts()
	local newScripts = {}
	for _, scr in ipairs(scripts) do
		if not processed[scr] then
			table.insert(newScripts, scr)
		end
	end

	if #newScripts == 0 then
		break
	end

	totalKnownScripts = totalKnownScripts + #newScripts
	statusLabel.Text = string.format("Pass %d: %d new scripts found", round, #newScripts)
	task.wait(0.5)
	processScriptList(newScripts, startTime)
	round = round + 1
until round > MAX_ROUNDS

local totalTime = math.floor(os.clock() - startTime)
updateGui("All done!", totalTime, 0, true)

task.wait(15)
pcall(function() screenGui:Destroy() end)

Features & Information

Decompiles all scripts in the game, saves them to executors workspace as .lua.

Community Comments (1)

katze7500katze7500May 2, 2026

could you make it save it as a single txt file

More Scripts for Universal Scripts