What should I add to my Windows GUI Luau Code?

I made a code that mirrors the Windows GUI based on a windows 11 game I played and I wanted to know if there’s any bugs or things I should add?

Code:

local UIS = game:GetService("UserInputService")
local player = Players.LocalPlayer

local gui = Instance.new("ScreenGui")
gui.Name = "WindowsSystem"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")

local taskbar = Instance.new("Frame")
taskbar.Size = UDim2.new(1, 0, 0, 40)
taskbar.Position = UDim2.new(0, 0, 1, -40)
taskbar.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
taskbar.BorderSizePixel = 0
taskbar.Parent = gui

local startButton = Instance.new("TextButton")
startButton.Size = UDim2.new(0, 120, 1, 0)
startButton.Text = "Windows"
startButton.TextColor3 = Color3.new(1,1,1)
startButton.BackgroundColor3 = Color3.fromRGB(35,35,35)
startButton.BorderSizePixel = 0
startButton.Parent = taskbar

local startMenu = Instance.new("Frame")
startMenu.Size = UDim2.new(0, 260, 0, 300)
startMenu.Position = UDim2.new(0, 0, 1, -340)
startMenu.BackgroundColor3 = Color3.fromRGB(40,40,40)
startMenu.BorderSizePixel = 0
startMenu.Visible = false
startMenu.Parent = gui

local menuLayout = Instance.new("UIListLayout")
menuLayout.Padding = UDim.new(0, 6)
menuLayout.Parent = startMenu

local windowFolder = Instance.new("Folder")
windowFolder.Name = "Windows"
windowFolder.Parent = gui

local function makeDraggable(frame, bar)
    local dragging = false
    local dragStart
    local startPos

    bar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = true
            dragStart = input.Position
            startPos = frame.Position
        end
    end)

    bar.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 then
            dragging = false
        end
    end)

    UIS.InputChanged:Connect(function(input)
        if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
            local delta = input.Position - dragStart
            frame.Position = startPos + UDim2.new(0, delta.X, 0, delta.Y)
        end
    end)
end

local function createWindow(title)
    local window = Instance.new("Frame")
    window.Size = UDim2.new(0, 420, 0, 300)
    window.Position = UDim2.new(0.3, 0, 0.2, 0)
    window.BackgroundColor3 = Color3.fromRGB(235,235,235)
    window.BorderSizePixel = 0
    window.Parent = windowFolder

    local titleBar = Instance.new("Frame")
    titleBar.Size = UDim2.new(1, 0, 0, 32)
    titleBar.BackgroundColor3 = Color3.fromRGB(45,45,45)
    titleBar.BorderSizePixel = 0
    titleBar.Parent = window

    local titleLabel = Instance.new("TextLabel")
    titleLabel.Size = UDim2.new(1, -40, 1, 0)
    titleLabel.Position = UDim2.new(0, 8, 0, 0)
    titleLabel.Text = title
    titleLabel.TextXAlignment = Enum.TextXAlignment.Left
    titleLabel.TextColor3 = Color3.new(1,1,1)
    titleLabel.BackgroundTransparency = 1
    titleLabel.Parent = titleBar

    local closeButton = Instance.new("TextButton")
    closeButton.Size = UDim2.new(0, 32, 1, 0)
    closeButton.Position = UDim2.new(1, -32, 0, 0)
    closeButton.Text = "X"
    closeButton.TextColor3 = Color3.new(1,1,1)
    closeButton.BackgroundColor3 = Color3.fromRGB(170, 50, 50)
    closeButton.BorderSizePixel = 0
    closeButton.Parent = titleBar

    closeButton.MouseButton1Click:Connect(function()
        window:Destroy()
    end)

    makeDraggable(window, titleBar)

    return window
end

local function createStartApp(name)
    local button = Instance.new("TextButton")
    button.Size = UDim2.new(1, -12, 0, 36)
    button.Position = UDim2.new(0, 6, 0, 0)
    button.Text = name
    button.TextColor3 = Color3.new(1,1,1)
    button.BackgroundColor3 = Color3.fromRGB(60,60,60)
    button.BorderSizePixel = 0
    button.Parent = startMenu

    button.MouseButton1Click:Connect(function()
        startMenu.Visible = false
        createWindow(name)
    end)
end

createStartApp("Notepad")
createStartApp("Explorer")
createStartApp("Settings")

startButton.MouseButton1Click:Connect(function()
    startMenu.Visible = not startMenu.Visible
end)

your codes fine for what i assume is a very simple project. id avoid creating new instances in code like this, i’d rather clone a pre-existing template and just change its values. more freedom, especially since as a roblox dev you’re gifted real-time ui changes while editing.

one thing i can say after skimming your code in like 10 seconds is that your dragging function is not reliable. for one, im confused on what bar is. two, i wouldnt make a new inputbegan, inputended, and inputchanged function for each draggable ui element. in my own game i determine which ui a player is hovering over, and operate appropriately, with just one of each function. if you continue using your approach, then use a maid class to disconnect the connections. theres a clear memory leak in your code.

i would make dragging completely non-dependent on a single object. i’d have it as a global thing.

there are no apparent bugs. and what you add is on you. this is a code review page. solid code for what it is, except that drag function.

Thanks for the advice.

this is the bar btw:

i didnt know ui objects had an inputbegan property. but yeah definitely maid-class your connections

also this is off topic but if ur on windows consider going to linux’s zorinOS, or if your stuck on a windows machine like i am then use a tool like privacy.sexy to remove most of windows bloatware spyware and telemetry

Straight-up lie;
Cloning is REALLY EXPENSIVE according to literally every benchmark.

If you want to automate it, you can use compilers like Hierarchy Saver

The most optimized way to build UI is through code only.
Combined with Narrowing the LuaBridge overhead (old)

why whenever I see this post it’s always the creator advertising their thing.

Your logic makes no sense. You want me to offer you paid alternatives that are less functional?

What does it has to mean?

Summary

This text will be hidden