Roblox Lua GUI: Draggable Executor Window Setup

🧩 Syntax:
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "ExecutorGUI"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 500, 0, 350)
frame.Position = UDim2.new(0.5, -250, 0.5, -175)
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
frame.Parent = screenGui

local uicorner = Instance.new("UICorner")
uicorner.CornerRadius = UDim.new(0, 12)
uicorner.Parent = frame

local titleBar = Instance.new("Frame")
titleBar.Size = UDim2.new(1, 0, 0, 40)
titleBar.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
titleBar.Parent = frame

local titleBarCorner = Instance.new("UICorner")
titleBarCorner.CornerRadius = UDim.new(0, 12) -- Adjust the radius as needed
titleBarCorner.Parent = titleBar

local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, -120, 1, 0)
titleLabel.Position = UDim2.new(0, 10, 0, 0)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "Lua Executor"
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextSize = 18
titleLabel.TextXAlignment = Enum.TextXAlignment.Left
titleLabel.Parent = titleBar


local minimizeBtn = Instance.new("TextButton")
minimizeBtn.Size = UDim2.new(0, 40, 0, 35)
minimizeBtn.Position = UDim2.new(1, -80, 0, 2.5)
minimizeBtn.BackgroundColor3 = Color3.fromRGB(50, 120, 200)
minimizeBtn.Text = "-"
minimizeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
minimizeBtn.Font = Enum.Font.GothamBold
minimizeBtn.TextSize = 22
local minCorner = Instance.new("UICorner")
minCorner.CornerRadius = UDim.new(0, 6)
minCorner.Parent = minimizeBtn
minimizeBtn.Parent = titleBar

local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 40, 0, 35)
closeBtn.Position = UDim2.new(1, -40, 0, 2.5)
closeBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.Font = Enum.Font.GothamBold
closeBtn.TextSize = 20
local closeCorner = Instance.new("UICorner")
closeCorner.CornerRadius = UDim.new(0, 6)
closeCorner.Parent = closeBtn
closeBtn.Parent = titleBar

local inputBox = Instance.new("TextBox")
inputBox.Size = UDim2.new(1, -20, 1, -110)
inputBox.Position = UDim2.new(0, 10, 0, 50)
inputBox.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
inputBox.TextColor3 = Color3.fromRGB(230, 230, 230)
inputBox.Font = Enum.Font.Code
inputBox.TextSize = 14
inputBox.ClearTextOnFocus = false
inputBox.MultiLine = true
inputBox.TextWrapped = true
inputBox.Text = "Write Lua code here"
local inputCorner = Instance.new("UICorner")
inputCorner.CornerRadius = UDim.new(0, 8)
inputCorner.Parent = inputBox
inputBox.Parent = frame

local executeBtn = Instance.new("TextButton")
executeBtn.Size = UDim2.new(0, 100, 0, 35)
executeBtn.Position = UDim2.new(0, 10, 1, -50)
executeBtn.BackgroundColor3 = Color3.fromRGB(40, 180, 90)
executeBtn.Text = "Execute"
executeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
executeBtn.Font = Enum.Font.GothamBold
executeBtn.TextSize = 16
local btnCorner = Instance.new("UICorner")
btnCorner.CornerRadius = UDim.new(0, 8)
btnCorner.Parent = executeBtn
executeBtn.Parent = frame

local clearBtn = Instance.new("TextButton")
clearBtn.Size = UDim2.new(0, 100, 0, 35)
clearBtn.Position = UDim2.new(0, 120, 1, -50)
clearBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
clearBtn.Text = "Clear"
clearBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
clearBtn.Font = Enum.Font.GothamBold
clearBtn.TextSize = 16
local clearCorner = Instance.new("UICorner")
clearCorner.CornerRadius = UDim.new(0, 8)
clearCorner.Parent = clearBtn
clearBtn.Parent = frame

executeBtn.MouseButton1Click:Connect(function()
    local code = inputBox.Text
    local f, err = loadstring(code) or load(code)
    if f then pcall(f) end
end)

clearBtn.MouseButton1Click:Connect(function()
    inputBox.Text = ""
end)

local minimized = false
minimizeBtn.MouseButton1Click:Connect(function()
    if minimized then
        TweenService:Create(frame, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 500, 0, 350)}):Play()
        inputBox.Visible = true
        executeBtn.Visible = true
        clearBtn.Visible = true
        minimized = false
    else
        TweenService:Create(frame, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = UDim2.new(0, 500, 0, 40)}):Play()
        inputBox.Visible = false
        executeBtn.Visible = false
        clearBtn.Visible = false
        minimized = true
    end
end)

local popupVisible = false
local function createConfirmationPopup()
    if popupVisible then return end
    popupVisible = true

    local popup = Instance.new("Frame")
    popup.Size = UDim2.new(0, 0, 0, 0)
    popup.Position = UDim2.new(0.5, 0, 0.5, 0)
    popup.AnchorPoint = Vector2.new(0.5, 0.5)
    popup.BackgroundColor3 = Color3.fromRGB(32, 32, 32)
    popup.BorderSizePixel = 0
    popup.Parent = frame
    local corner = Instance.new("UICorner")
    corner.CornerRadius = UDim.new(0, 14)
    corner.Parent = popup

    local label = Instance.new("TextLabel")
    label.Size = UDim2.new(1, -20, 0, 50)
    label.Position = UDim2.new(0, 10, 0, 10)
    label.BackgroundTransparency = 1
    label.Text = "Are you sure you want to close the executor?"
    label.TextColor3 = Color3.fromRGB(245, 245, 245)
    label.Font = Enum.Font.GothamSemibold
    label.TextSize = 16
    label.TextWrapped = true
    label.TextXAlignment = Enum.TextXAlignment.Center
    label.Parent = popup

    local yesBtn = Instance.new("TextButton")
    yesBtn.Size = UDim2.new(0, 90, 0, 30)
    yesBtn.Position = UDim2.new(0, 40, 1, -50)
    yesBtn.BackgroundColor3 = Color3.fromRGB(45, 200, 110)
    yesBtn.Text = "Yes"
    yesBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    yesBtn.Font = Enum.Font.GothamBold
    yesBtn.TextSize = 14
    local yesCorner = Instance.new("UICorner")
    yesCorner.CornerRadius = UDim.new(0, 6)
    yesCorner.Parent = yesBtn
    yesBtn.Parent = popup

    local noBtn = Instance.new("TextButton")
    noBtn.Size = UDim2.new(0, 90, 0, 30)
    noBtn.Position = UDim2.new(1, -130, 1, -50)
    noBtn.BackgroundColor3 = Color3.fromRGB(200, 60, 60)
    noBtn.Text = "No"
    noBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    noBtn.Font = Enum.Font.GothamBold
    noBtn.TextSize = 14
    local noCorner = Instance.new("UICorner")
    noCorner.CornerRadius = UDim.new(0, 6)
    noCorner.Parent = noBtn
    noBtn.Parent = popup

    TweenService:Create(popup, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0, 260, 0, 140)}):Play()

    local function animateButton(btn, color)
        btn.MouseEnter:Connect(function()
            TweenService:Create(btn, TweenInfo.new(0.15), {BackgroundColor3 = color:Lerp(Color3.new(1,1,1),0.15)}):Play()
        end)
        btn.MouseLeave:Connect(function()
            TweenService:Create(btn, TweenInfo.new(0.15), {BackgroundColor3 = color}):Play()
        end)
    end

    animateButton(yesBtn, Color3.fromRGB(45, 200, 110))
    animateButton(noBtn, Color3.fromRGB(200, 60, 60))

    yesBtn.MouseButton1Click:Connect(function()
        screenGui:Destroy()
    end)

    noBtn.MouseButton1Click:Connect(function()
        TweenService:Create(popup, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Size = UDim2.new(0, 0, 0, 0)}):Play()
        task.wait(0.25)
        popup:Destroy()
        popupVisible = false
    end)
end

closeBtn.MouseButton1Click:Connect(function()
    createConfirmationPopup()
end)