Gui to Lua ~ Convert GUI's and Models into Lua, Roact & Fusion

Gui to Lua

Transform GUIs and models into Lua scripts in one click! :rocket:


Latest Updates

September 18, 2023

  • Complete rewrite for way better performance.

November 30, 2023

  • Outputs are now always a single script.

March 17, 2024

  • Add support for Path2D.

Why Choose Gui to Lua?

Gui to Lua offers a seamless experience with these standout features:

  • Easy To Use: User interface is simple and easy to understand.
  • Always Up-to-Date: Utilizes Roblox Studio’s API Dump (2023-02-08T00:00:00Z).
  • Comprehensive Conversion: Captures every accessible property and attributes.
  • Versatile Outputs:
    • Regular Lua
    • Roact
    • Fusion
  • Handles Large Instances: Convert practically unlimited instance sizes.
  • Flexible Output Formats:
    • Legacy
    • Compact
    • Supercompact
  • Undo Support: Mistakes? No worries, undo your changes.
  • Robust: Handles all the edge cases for you.
  • Reliable: Receive enhancement updates whenever needed.

Note: Scripts, LocalScripts, and ModuleScripts are excluded from Roact and Fusion outputs.


Output Examples

Legacy

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

-- ...

Compact Fusion

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, },
	}
}

More formats, including Supercompact, are available in the plugin!


Previews

image




Issues?

Encountering a problem? Report it here, and I’ll address it ASAP! :tada:


Gui to Lua

(https://www.roblox.com/library/12401790032/Gui-to-Lua)

Enjoy scripting with ease! :blush:

6 Likes

That’s a nice plugin, many usage cases. The only thing I cant understand is why its called GUI to Lua?

2 Likes

The true purpose of the plugin is unclear to me. What purpose does it serve?

I think the more important question is: What problem does it solve?

I mean, it converts GUIs to scripts, sure. But what issue does it fix?

It would’ve been nicer if it converted GUIs to functions instead. That way, you could call it from the rest of your code and it would create that GUI element. Or, it could utilize another library such as Fusion or Roact to make code size smaller and make it more useful.

1 Like

Its called Gui to Lua because the main purpose of it is to convert GUI’s into script. The way that it was made allows it to process models aswell but is not guaranteed to work (stuff being not creatable, stuff inside non creatable instances, the kind of stuff that never really happens in gui’s)


The problem that this solves is when you need to create an instance from code. For example when you need to make a UI library or something of that sort. I do agree that the use case is pretty niche but when you do need it it’s really nice to have something that does it for you.


You can use the output of the plugin to create the functions that you need in your code, worst case scenario you could literally paste the output of the plugin into a function and use it.


I will look into adding support for those libraries.

But wouldn’t most people use Fusion or Roact for that?

1 Like

Roact and Fusion create the ui, this plugin writes the code that creates the ui. (Roact and Fusion support soon)

1 Like

that’s not something I’d necessarily use but cool concept

1 Like