Gui to Lua
This plugin allows you to convert GUI’s and most models to Lua script, in just a few clicks!
UPDATE (September 18, 2023)
Plugin got a full rewrite, it is now much faster.November 30, 2023
Plugin no longer splits large outputs.before:
after:
Why this plugin is good
This plugin will:- Work forever because it uses uses roblox studio’s api dump (2023-02-08T00:00:00Z)
- Convert every accessible property
- Convert attributes
- Let you convert objects into regular Lua, Roact and Fusion 1*
- Let you convert instances of practically unlimited sizes
- Let you generate different types of outputs
- Recieve updates when needed
- Support undo (lol)
1* Scripts, LocalScripts and ModuleScripts will not be converted when using Roact or Fusion.
A few examples of the different types of outputs:
Legacy
--[[
Gui2Lua Winning! ~ Ch0nky Code:tm:
6 instances
]]--
local tbl =
{
ScreenGui = Instance.new("ScreenGui"),
Frame = Instance.new("Frame"),
ImageLabel = Instance.new("ImageLabel"),
src = Instance.new("LocalScript"),
m1 = Instance.new("ModuleScript"),
m2 = Instance.new("ModuleScript"),
}
tbl.ScreenGui.Enabled = false
tbl.ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
tbl.ScreenGui.Parent = game:GetService("StarterGui")
tbl.Frame.Size = UDim2.new(0, 100, 0, 100)
tbl.Frame.Position = UDim2.new(0.459109, 0, 0.418301, 0)
tbl.Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
tbl.Frame.Parent = tbl.ScreenGui
tbl.ImageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
tbl.ImageLabel.Image = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Large/CommandBar@3x.png"
tbl.ImageLabel.Size = UDim2.new(0, 100, 0, 100)
tbl.ImageLabel.Parent = tbl.Frame
tbl.src.Name = "src"
tbl.src.Parent = tbl.ScreenGui
tbl.m1.Name = "m1"
tbl.m1.Parent = tbl.src
tbl.m2.Name = "m2"
tbl.m2.Parent = tbl.src
local modules, cache = {}, {}
modules[tbl.m1] = function()
local module = {}
module.str = "hello from M1"
module.p = print
return module
end
modules[tbl.m2] = function()
local module = {}
module.str = "hello from M2"
module.p = function(str)
print(str .. " yuhh")
end
return module
end
local o_require = require;
local function require(module)
local real, cached = modules[module], cache[module]
if cached then return cached end
if not real then return o_require(module) end
cache[module] = real()
return cache[module]
end
task.spawn(function()
local script = tbl.src
local m1, m2 = require(script.m1), require(script.m2)
m1.p(require(script.m1) == require(script.m1), m1.str, m1.p == m2.p)
-- > true hello from M1 false
end)
Outputs
Compact
--[[
Gui2Lua Winning! ~ Ch0nky Code:tm:
6 instances
]]--
local tbl =
{
ScreenGui = Instance.new("ScreenGui"),
Frame = Instance.new("Frame"),
ImageLabel = Instance.new("ImageLabel"),
src = Instance.new("LocalScript"),
m1 = Instance.new("ModuleScript"),
m2 = Instance.new("ModuleScript"),
}
tbl.ScreenGui.Enabled = false; tbl.ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling; tbl.ScreenGui.Parent = game:GetService("StarterGui");
tbl.Frame.Size = UDim2.new(0, 100, 0, 100); tbl.Frame.Position = UDim2.new(0.459109, 0, 0.418301, 0); tbl.Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255); tbl.Frame.Parent = tbl.ScreenGui;
tbl.ImageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255); tbl.ImageLabel.Image = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Large/CommandBar@3x.png"; tbl.ImageLabel.Size = UDim2.new(0, 100, 0, 100); tbl.ImageLabel.Parent = tbl.Frame;
tbl.src.Name = "src"; tbl.src.Parent = tbl.ScreenGui;
tbl.m1.Name = "m1"; tbl.m1.Parent = tbl.src;
tbl.m2.Name = "m2"; tbl.m2.Parent = tbl.src;
local modules, cache = {}, {}
modules[tbl.m1] = function()
local module = {}
module.str = "hello from M1"
module.p = print
return module
end
modules[tbl.m2] = function()
local module = {}
module.str = "hello from M2"
module.p = function(str)
print(str .. " yuhh")
end
return module
end
local o_require = require;
local function require(module)
local real, cached = modules[module], cache[module]
if cached then return cached end
if not real then return o_require(module) end
cache[module] = real()
return cache[module]
end
task.spawn(function()
local script = tbl.src
local m1, m2 = require(script.m1), require(script.m2)
m1.p(require(script.m1) == require(script.m1), m1.str, m1.p == m2.p)
-- > true hello from M1 false
end)
Compact Fusion
--[[
Gui2Lua Winning! ~ Ch0nky Code:tm:
7 instances
]]--
local Fusion = {};
local New, Children = Fusion.New, Fusion.Children; -- you can change this local's name in the variable name field, format: "new_function_name;child_name"
local ScreenGui = New "ScreenGui" { Enabled = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
[Children] = {
Frame = New "Frame" { Size = UDim2.new(0, 100, 0, 100), Position = UDim2.new(0.459109, 0, 0.418301, 0), BackgroundColor3 = Color3.fromRGB(255, 255, 255),
[Children] = {
ImageLabel = New "ImageLabel" { BackgroundColor3 = Color3.fromRGB(255, 255, 255), Image = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Large/CommandBar@3x.png", Size = UDim2.new(0, 100, 0, 100), },
}
},
src = New "LocalScript" { Name = "src",
[Children] = {
m1 = New "ModuleScript" { Name = "m1", },
m2 = New "ModuleScript" { Name = "m2", },
}
},
TextButton = New "TextButton" { AutoButtonColor = false, BackgroundColor3 = Color3.fromRGB(255, 255, 255), FontFace = Font.new("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Regular, Enum.FontStyle.Normal), TextColor3 = Color3.fromRGB(0, 0, 0), Position = UDim2.new(0.226295, 0, 0.4947, 0), TextSize = 14, Size = UDim2.new(0, 200, 0, 50), Active = false, },
}
}
Supercompact
Which is basically minified.--[[
Gui2Lua Winning! ~ Ch0nky Code:tm:
6 instances
]]--
local tbl = { ScreenGui = Instance.new("ScreenGui"); Frame = Instance.new("Frame"); ImageLabel = Instance.new("ImageLabel"); src = Instance.new("LocalScript"); m1 = Instance.new("ModuleScript"); m2 = Instance.new("ModuleScript"); }
tbl.ScreenGui.Enabled = false; tbl.ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling; tbl.ScreenGui.Parent = game:GetService("StarterGui"); tbl.Frame.Size = UDim2.new(0, 100, 0, 100); tbl.Frame.Position = UDim2.new(0.459109, 0, 0.418301, 0); tbl.Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255); tbl.Frame.Parent = tbl.ScreenGui; tbl.ImageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255); tbl.ImageLabel.Image = "rbxasset://studio_svg_textures/Shared/WidgetIcons/Light/Large/CommandBar@3x.png"; tbl.ImageLabel.Size = UDim2.new(0, 100, 0, 100); tbl.ImageLabel.Parent = tbl.Frame; tbl.src.Name = "src"; tbl.src.Parent = tbl.ScreenGui; tbl.m1.Name = "m1"; tbl.m1.Parent = tbl.src; tbl.m2.Name = "m2"; tbl.m2.Parent = tbl.src;
local modules, cache = {}, {}
modules[tbl.m1] = function()
local module = {}
module.str = "hello from M1"
module.p = print
return module
end
modules[tbl.m2] = function()
local module = {}
module.str = "hello from M2"
module.p = function(str)
print(str .. " yuhh")
end
return module
end
local o_require = require;
local function require(module)
local real, cached = modules[module], cache[module]
if cached then return cached end
if not real then return o_require(module) end
cache[module] = real()
return cache[module]
end
task.spawn(function()
local script = tbl.src
local m1, m2 = require(script.m1), require(script.m2)
m1.p(require(script.m1) == require(script.m1), m1.str, m1.p == m2.p)
-- > true hello from M1 false
end)
All three output formats have their own legacy, compact and supercompact output.
Preview
Issues
If you have any issues with the plugin, please report them on this thread so that i can fix them ASAP.shout out to this guy (literally saved me wow)
this is my first thread
Gui to Lua
Enjoy!