Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- local nameTextBox = Instance.new("TextBox")
- nameTextBox.Size = UDim2.new(0, 200, 0, 50)
- nameTextBox.Position = UDim2.new(0, 10, 0, 10)
- nameTextBox.PlaceholderText = "Имя фрейма"
- nameTextBox.Parent = screenGui
- local parentTextBox = Instance.new("TextBox")
- parentTextBox.Size = UDim2.new(0, 200, 0, 50)
- parentTextBox.Position = UDim2.new(0, 220, 0, 10)
- parentTextBox.PlaceholderText = "Имя родителя"
- parentTextBox.Parent = screenGui
- local convertButton = Instance.new("TextButton")
- convertButton.Size = UDim2.new(0, 200, 0, 50)
- convertButton.Position = UDim2.new(0, 430, 0, 10)
- convertButton.Text = "Конвертировать в Lua"
- convertButton.Parent = screenGui
- local function createBlock(blockType, name, parentName)
- local parent = screenGui:FindFirstChild(parentName) or screenGui
- local block = Instance.new(blockType)
- block.Name = name
- block.Size = UDim2.new(0, 100, 0, 50)
- block.Position = UDim2.new(0.5, 0, 0.5, 0)
- block.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
- block.Active = true
- block.Parent = parent
- block.AnchorPoint = Vector2.new(0.5, 0.5)
- local dragging = false
- local dragInput, mousePos, framePos
- block.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- mousePos = input.Position
- framePos = block.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- block.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
- local delta = input.Position - mousePos
- block.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y)
- end
- end)
- local resizeHandle = Instance.new("ImageButton")
- resizeHandle.Size = UDim2.new(0, 30, 0, 30)
- resizeHandle.Position = UDim2.new(1, -10, 1, -10)
- resizeHandle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
- resizeHandle.Image = "rbxassetid://115903044577530" -- Замените на ID вашего изображения
- resizeHandle.Parent = block
- local resizing = false
- local resizeInput, resizeMousePos, resizeFrameSize
- resizeHandle.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- resizing = true
- resizeMousePos = input.Position
- resizeFrameSize = block.Size
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- resizing = false
- end
- end)
- end
- end)
- resizeHandle.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- resizeInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == resizeInput and resizing then
- local delta = input.Position - resizeMousePos
- block.Size = UDim2.new(resizeFrameSize.X.Scale, resizeFrameSize.X.Offset + delta.X, resizeFrameSize.Y.Scale, resizeFrameSize.Y.Offset + delta.Y)
- end
- end)
- local deleteButton = Instance.new("ImageButton")
- deleteButton.Size = UDim2.new(0, 30, 0, 30)
- deleteButton.Position = UDim2.new(1, -20, 0, 0)
- deleteButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
- deleteButton.Image = "rbxassetid://81303447485944" -- Замените на ID вашего изображения
- deleteButton.Parent = block
- deleteButton.MouseButton1Click:Connect(function()
- block:Destroy()
- end)
- end
- local function createButton(buttonText, blockType)
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = UDim2.new(0, 10, 0, 70 + (#screenGui:GetChildren() - 3) * 60)
- button.Text = buttonText
- button.Parent = screenGui
- button.MouseButton1Click:Connect(function()
- local name = nameTextBox.Text
- local parentName = parentTextBox.Text
- createBlock(blockType, name, parentName)
- end)
- end
- createButton("Создать TextButton", "TextButton")
- createButton("Создать Frame", "Frame")
- createButton("Создать UICorner", "UICorner")
- local function convertToLua()
- local function serialize(instance)
- local props = {}
- for _, prop in ipairs({"Name", "Size", "Position", "BackgroundColor3", "Parent"}) do
- local success, value = pcall(function() return instance[prop] end)
- if success then
- if prop == "Parent" then
- value = value and value.Name or "nil"
- end
- table.insert(props, string.format("%s = %s", prop, tostring(value)))
- end
- end
- return string.format("local %s = Instance.new('%s')\n%s\n%s.Parent = %s",
- instance.Name, instance.ClassName, table.concat(props, "\n"), instance.Name, instance.Parent and instance.Parent.Name or "nil")
- end
- local code = {}
- for _, child in ipairs(screenGui:GetChildren()) do
- if child:IsA("GuiObject") and child ~= nameTextBox and child ~= parentTextBox and child ~= convertButton then
- table.insert(code, serialize(child))
- end
- end
- print(table.concat(code, "\n\n"))
- end
- convertButton.MouseButton1Click:Connect(convertToLua)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement