Roblox2Lua - Convert anything to a single script

r2logo


Roblox2Lua

Roblox2Lua converts anything you have - GUIs or models - into a simple script, in under a second!


Purpose

Roblox2Lua has been created to replace most outdated serialization plugins, i.e. GuiToLua or Luazifier. This plugin uses up-to-date script conversion and a modern user interface and will be supported forever!

Benefits

Roblox2Lua is (mostly) always up-to-date, due to it having the dynamic API dump from MaximumADHD’s Github.
The plugin strives at GUI conversion, as it was tested and optimized specifically for it.

Issues

This plugin has an issue with serializing massive models with lots of layers. The normal user should never hit the limit, but I am working on a “Minify” setting to aid the struggle.

Feedback

Let me know any issues or suggestions you have for this plugin! It’s the first plugin I’ve made in a really long time, so let me know if I missed anything.


Preview

--[[
	Roblox2Lua
	----------
	
	This code was generated using
	Deluct's Roblox2Lua plugin.
]]--

--// Instances

local part = Instance.new("Part")
part.BottomSurface = Enum.SurfaceType.Smooth
part.CFrame = CFrame.fromMatrix(Vector3.new(-0.7300000190734863, 1.5000050067901611, -0.699999988079071), Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1))
part.Size = Vector3.new(4, 1, 2)
part.TopSurface = Enum.SurfaceType.Smooth
part.Parent = workspace

local part2 = Instance.new("Part")
part2.BottomSurface = Enum.SurfaceType.Smooth
part2.CFrame = CFrame.fromMatrix(Vector3.new(-0.7300000190734863, 1.5000050067901611, -0.699999988079071), Vector3.new(1, 0, 0), Vector3.new(0, 1, 0), Vector3.new(0, 0, 1))
part2.Size = Vector3.new(4, 1, 2)
part2.TopSurface = Enum.SurfaceType.Smooth
part2.Name = "Part2"
part2.Parent = part

local script = Instance.new("Script")
script.Parent = part

local module_script = Instance.new("ModuleScript")
module_script.Parent = script

--// Modules

local modules = {
	[module_script] = function()
		return {
			say_hi = function()
				print("Hello from the ModuleScript!")
			end,
		}
	end
}

--// Scripts

-- Script
task.spawn(function()
	local script = script

	local oldreq = require
	local function require(target)
		if modules[target] then
			return modules[target]()
		end
		return oldreq(target)
	end

	local module = require(script:WaitForChild("ModuleScript"))
	module.say_hi()
	
	print("Hello from the script!")
end)

:wave:

14 Likes

nice! I bought it, how do I have it show up for me?

3 Likes

Just bought it personally I don’t like how it converts
it lowers all the local variables and how it formats the Instances
Personally, I like the original gui2lua plugin’s formatting better

2 Likes

I’ll make a setting for disabling the snake-case formatting, thank you for letting me know.

3 Likes

It should be a button in the Plugins tab which’ll open the widget.

1 Like

No like when the script has been made I didnt see my UI in game

1 Like

You have to make sure that the parent of the ScreenGui is the StarterGui, since iirc it auto parents it to workspace.

1 Like

great thanks!

how do I make sure my drag script works? (It does not, drag is at the bottom)

--[[
	Roblox2Lua
	----------
	
	This code was generated using
	Deluct's Roblox2Lua plugin.
]]--

--// Instances

local insider = Instance.new("ScreenGui")
insider.Name = "Insider"
insider.Parent = game.StarterGui

local main = Instance.new("Frame")
main.BackgroundColor3 = Color3.new(0.133333, 0.133333, 0.133333)
main.Position = UDim2.new(0.280448705, 0, 0.271659315, 0)
main.Size = UDim2.new(0, 548, 0, 311)
main.Name = "main"
main.Parent = insider

local uicorner = Instance.new("UICorner")
uicorner.CornerRadius = UDim.new(0, 14)
uicorner.Parent = main

local uistroke = Instance.new("UIStroke")
uistroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
uistroke.Color = Color3.new(0.784314, 0.784314, 0.784314)
uistroke.Parent = main

local drag = Instance.new("LocalScript")
drag.Name = "drag"
drag.Parent = main

local line = Instance.new("Frame")
line.BackgroundColor3 = Color3.new(0.392157, 0.392157, 0.392157)
line.BorderSizePixel = 0
line.Position = UDim2.new(-0.000573151279, 0, 0.825337231, 0)
line.Size = UDim2.new(0, 548, 0, 1)
line.Name = "line"
line.Parent = main

local buttons = Instance.new("Frame")
buttons.BackgroundColor3 = Color3.new(1, 1, 1)
buttons.BackgroundTransparency = 1
buttons.Position = UDim2.new(0, 0, 0.828552663, 0)
buttons.Size = UDim2.new(0, 547, 0, 53)
buttons.Name = "buttons"
buttons.Parent = main

local home = Instance.new("TextButton")
home.Font = Enum.Font.SourceSans
home.Text = ""
home.TextColor3 = Color3.new(0, 0, 0)
home.TextSize = 14
home.BackgroundColor3 = Color3.new(1, 1, 1)
home.Position = UDim2.new(0.0218777936, 0, 0.213795975, 0)
home.Size = UDim2.new(0, 30, 0, 30)
home.Name = "Home"
home.Parent = buttons

local uistroke_2 = Instance.new("UIStroke")
uistroke_2.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
uistroke_2.Color = Color3.new(0.784314, 0.784314, 0.784314)
uistroke_2.Parent = home

local uicorner_2 = Instance.new("UICorner")
uicorner_2.CornerRadius = UDim.new(0, 7)
uicorner_2.Parent = home

local uigradient = Instance.new("UIGradient")
uigradient.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.new(0.313726, 0.313726, 0.313726)), ColorSequenceKeypoint.new(1, Color3.new(0.0823529, 0.0823529, 0.0823529))})
uigradient.Rotation = -100
uigradient.Parent = home

local home_2 = Instance.new("ImageButton")
home_2.Image = "rbxassetid://3926305904"
home_2.ImageRectOffset = Vector2.new(964, 204)
home_2.ImageRectSize = Vector2.new(36, 36)
home_2.BackgroundTransparency = 1
home_2.Position = UDim2.new(0.0782051012, 0, 0.0763583183, 0)
home_2.Size = UDim2.new(0, 25, 0, 25)
home_2.ZIndex = 2
home_2.Name = "home"
home_2.Parent = home

local local_player = Instance.new("TextButton")
local_player.Font = Enum.Font.SourceSans
local_player.Text = ""
local_player.TextColor3 = Color3.new(0, 0, 0)
local_player.TextSize = 14
local_player.BackgroundColor3 = Color3.new(1, 1, 1)
local_player.Position = UDim2.new(0.0986602455, 0, 0.213795975, 0)
local_player.Size = UDim2.new(0, 30, 0, 30)
local_player.Name = "LocalPlayer"
local_player.Parent = buttons

local uistroke_3 = Instance.new("UIStroke")
uistroke_3.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
uistroke_3.Color = Color3.new(0.784314, 0.784314, 0.784314)
uistroke_3.Parent = local_player

local uicorner_3 = Instance.new("UICorner")
uicorner_3.CornerRadius = UDim.new(0, 7)
uicorner_3.Parent = local_player

local uigradient_2 = Instance.new("UIGradient")
uigradient_2.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, Color3.new(0.313726, 0.313726, 0.313726)), ColorSequenceKeypoint.new(1, Color3.new(0.0823529, 0.0823529, 0.0823529))})
uigradient_2.Rotation = -100
uigradient_2.Parent = local_player

local home_3 = Instance.new("ImageButton")
home_3.Image = "rbxassetid://3926305904"
home_3.ImageRectOffset = Vector2.new(964, 204)
home_3.ImageRectSize = Vector2.new(36, 36)
home_3.BackgroundTransparency = 1
home_3.Position = UDim2.new(0.0782051012, 0, 0.0763583183, 0)
home_3.Size = UDim2.new(0, 25, 0, 25)
home_3.ZIndex = 2
home_3.Name = "home"
home_3.Parent = local_player

--//Modules

local modules = {}

--// Scripts

-- drag
task.spawn(function()
	local script = drag

	local oldreq = require
	local function require(target)
		if modules[target] then
			return modules[target]()
		end
		return oldreq(target)
	end

	local UserInputService = game:GetService("UserInputService")
	local gui = main
	
	local dragging
	local dragInput
	local dragStart
	local startPos
	
	local function update(input)
		local delta = input.Position - dragStart
		gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
	end
	
	gui.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			dragStart = input.Position
			startPos = gui.Position
	
			input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					dragging = false
				end
			end)
		end
	end)
	
	gui.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
			dragInput = input
		end
	end)
	
	UserInputService.InputChanged:Connect(function(input)
		if input == dragInput and dragging then
			if gui.Visible then
				update(input)
			end
		end
	end)
	
end)

Are there any errors in the output?

16:08:20.622 Array is not a supported attribute type - Server - ServerCoreScripts/ServerLeaderstats:39

Found a bug where if you try and convert richtext it won’t come out correctly
Expected: “Made by: <|font color=”#33cc99">UserName</font|>"
Got: “Made by: “Made by: <|font color=”#33cc99”>UserName</font|>"
Added | to prevent the website from converting it

I feel like the icon should have the R be the current Roblox logo and the L be the Lua icon.

Edit: I just saw this was a month ago my bad :grimacing:

I have a problem with the plugin it does not copy transparency and will most of the time glitch out when doing models

Hey, I’m wondering what this plugin is good for. Why would one want their GUI in a script?

  • sam

Nice will check out later one of my favourite plug-ins

Its good for creating gui libraries

What in tarnation is a gui library?

A GUI lib allows developers to make UI easily using pre-defined components, such as buttons.
Example:

local lib = require(path.to.lib)

local button = lib.Button("foo")

OHHHH so like putting a local script in a button and then telling the script to run another script? something like that?

the font “Michroma” does not get detected as a font and is put as .Unknown, which destroys my uis. its easy for me to manually edit the script but it just takes up unnecessary time. please fix