Free Cool GUi
Key RequiredUniversal

Free Cool GUi

Universal ScriptDefyzDefyz 2.3K views 48 executesUpdated Aug 18, 2025
Unrated
00
Lua Scriptβ€’378 lines (12728 chars)
--// Simple Stupid GUI

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


local function getGuiParent()
    local ok, core = pcall(function() return (gethui and gethui()) or game:GetService("CoreGui") end)
    if ok and core then return core end
    return LocalPlayer:WaitForChild("PlayerGui")
end

-- Quick UI constructors
local function new(inst, props, parent)
    local o = Instance.new(inst)
    for k, v in pairs(props or {}) do o[k] = v end
    if parent then o.Parent = parent end
    return o
end

-- Root GUI
local ScreenGui = new("ScreenGui", {
    Name = "DefyMiniGUI",
    ResetOnSpawn = false,
    ZIndexBehavior = Enum.ZIndexBehavior.Sibling
}, getGuiParent())

-- Main Window
local Window = new("Frame", {
    Name = "Window",
    Size = UDim2.fromOffset(420, 330),
    Position = UDim2.fromScale(0.25, 0.25),
    BackgroundColor3 = Color3.fromRGB(22, 22, 28),
    BorderSizePixel = 0
}, ScreenGui)
new("UICorner", { CornerRadius = UDim.new(0, 14) }, Window)
new("UIStroke", { Color = Color3.fromRGB(70, 70, 90), Thickness = 1, Transparency = 0.25 }, Window)

-- TitleBar (drag handle)
local TitleBar = new("Frame", {
    Name = "TitleBar",
    Size = UDim2.new(1, 0, 0, 40),
    BackgroundColor3 = Color3.fromRGB(28, 28, 38),
    BorderSizePixel = 0
}, Window)
new("UICorner", { CornerRadius = UDim.new(0, 14) }, TitleBar)
local Title = new("TextLabel", {
    Name = "Title",
    Text = "Defy UI β€” Demo Controls",
    Font = Enum.Font.GothamBold,
    TextSize = 16,
    TextColor3 = Color3.fromRGB(235, 235, 245),
    BackgroundTransparency = 1,
    Size = UDim2.new(1, -16, 1, 0),
    Position = UDim2.fromOffset(12, 0),
    TextXAlignment = Enum.TextXAlignment.Left
}, TitleBar)

-- Dragging
do
    local dragging, dragStart, startPos
    TitleBar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = Window.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then dragging = false end
            end)
        end
    end)
    UIS.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            local delta = input.Position - dragStart
            Window.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
        end
    end)
end

-- Content Holder
local Body = new("Frame", {
    Name = "Body",
    BackgroundTransparency = 1,
    Size = UDim2.new(1, -24, 1, -56),
    Position = UDim2.fromOffset(12, 46)
}, Window)
local grid = new("UIGridLayout", {
    CellSize = UDim2.fromOffset(196, 64),
    CellPadding = UDim2.fromOffset(12, 12),
    FillDirectionMaxCells = 2,
    SortOrder = Enum.SortOrder.LayoutOrder
}, Body)

local function card(titleText)
    local f = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(30, 30, 42),
        BorderSizePixel = 0
    }, Body)
    new("UICorner", { CornerRadius = UDim.new(0, 12) }, f)
    new("UIStroke", { Color = Color3.fromRGB(80, 80, 110), Thickness = 1, Transparency = 0.35 }, f)
    new("TextLabel", {
        Text = titleText,
        Font = Enum.Font.GothamSemibold,
        TextSize = 14,
        TextColor3 = Color3.fromRGB(220, 220, 235),
        BackgroundTransparency = 1,
        Size = UDim2.new(1, -16, 0, 20),
        Position = UDim2.fromOffset(8, 6),
        TextXAlignment = Enum.TextXAlignment.Left
    }, f)
    return f
end

-- BUTTON
do
    local c = card("Button")
    local btn = new("TextButton", {
        Text = "Click Me",
        Font = Enum.Font.GothamBold,
        TextSize = 16,
        TextColor3 = Color3.fromRGB(240, 240, 255),
        BackgroundColor3 = Color3.fromRGB(60, 60, 110),
        Size = UDim2.fromOffset(160, 30),
        Position = UDim2.new(0, 18, 0, 28),
        AutoButtonColor = false
    }, c)
    new("UICorner", { CornerRadius = UDim.new(0, 10) }, btn)
    btn.MouseButton1Click:Connect(function()
        print("[Defy UI] Button pressed!")
        btn.Text = "Clicked!"
        task.delay(0.6, function() btn.Text = "Click Me" end)
    end)
end

-- TEXTBOX
do
    local c = card("TextBox")
    local box = new("TextBox", {
        PlaceholderText = "Type here...",
        Text = "",
        ClearTextOnFocus = false,
        Font = Enum.Font.Gotham,
        TextSize = 14,
        TextColor3 = Color3.fromRGB(230, 230, 240),
        BackgroundColor3 = Color3.fromRGB(45, 45, 65),
        Size = UDim2.fromOffset(170, 30),
        Position = UDim2.new(0, 14, 0, 28)
    }, c)
    new("UICorner", { CornerRadius = UDim.new(0, 8) }, box)
    box.FocusLost:Connect(function(enterPressed)
        print("[Defy UI] Text:", box.Text, " submitted=", enterPressed)
    end)
end

-- TOGGLE (checkbox style)
do
    local c = card("Toggle")
    local state = false
    local holder = new("Frame", {
        BackgroundTransparency = 1,
        Size = UDim2.fromOffset(170, 30),
        Position = UDim2.new(0, 14, 0, 28)
    }, c)
    local box = new("TextButton", {
        Text = "",
        AutoButtonColor = false,
        BackgroundColor3 = Color3.fromRGB(36, 36, 52),
        Size = UDim2.fromOffset(26, 26),
        Position = UDim2.fromOffset(0, 2)
    }, holder)
    new("UICorner", { CornerRadius = UDim.new(0, 6) }, box)
    local mark = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(120, 200, 120),
        Size = UDim2.fromScale(0, 0),
        Position = UDim2.fromScale(0.5, 0.5),
        AnchorPoint = Vector2.new(0.5, 0.5),
        Visible = false
    }, box)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, mark)
    local label = new("TextLabel", {
        BackgroundTransparency = 1,
        Text = "Enabled",
        Font = Enum.Font.Gotham,
        TextSize = 14,
        TextColor3 = Color3.fromRGB(220, 220, 235),
        Position = UDim2.fromOffset(34, 0),
        Size = UDim2.fromOffset(120, 30),
        TextXAlignment = Enum.TextXAlignment.Left
    }, holder)

    local function set(v)
        state = v
        mark.Visible = v
        mark.Size = v and UDim2.fromOffset(16, 16) or UDim2.fromOffset(0, 0)
        box.BackgroundColor3 = v and Color3.fromRGB(56, 90, 56) or Color3.fromRGB(36, 36, 52)
        label.Text = v and "Enabled" or "Disabled"
        print("[Defy UI] Toggle:", v)
    end
    box.MouseButton1Click:Connect(function() set(not state) end)
    set(false)
end

-- SWITCH (iOS-style)
do
    local c = card("Switch")
    local on = false
    local track = new("TextButton", {
        Text = "",
        AutoButtonColor = false,
        BackgroundColor3 = Color3.fromRGB(70, 70, 90),
        Size = UDim2.fromOffset(60, 28),
        Position = UDim2.new(0, 14, 0, 28)
    }, c)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, track)
    local knob = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(235, 235, 245),
        Size = UDim2.fromOffset(24, 24),
        Position = UDim2.fromOffset(2, 2)
    }, track)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, knob)

    local function set(v)
        on = v
        track.BackgroundColor3 = v and Color3.fromRGB(90, 150, 255) or Color3.fromRGB(70, 70, 90)
        knob.Position = v and UDim2.fromOffset(60-24-2, 2) or UDim2.fromOffset(2, 2)
        print("[Defy UI] Switch:", v)
    end
    track.MouseButton1Click:Connect(function() set(not on) end)
    set(false)
end

-- DROPDOWN
do
    local c = card("Dropdown")
    local open = false
    local options = { "Option A", "Option B", "Option C" }
    local selected = "Select…"

    local header = new("TextButton", {
        Text = selected .. "  β–Ύ",
        Font = Enum.Font.Gotham,
        TextSize = 14,
        TextColor3 = Color3.fromRGB(230, 230, 240),
        AutoButtonColor = false,
        BackgroundColor3 = Color3.fromRGB(45, 45, 65),
        Size = UDim2.fromOffset(170, 30),
        Position = UDim2.new(0, 14, 0, 28)
    }, c)
    new("UICorner", { CornerRadius = UDim.new(0, 8) }, header)

    local list = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(40, 40, 58),
        Size = UDim2.fromOffset(170, 0),
        Position = UDim2.new(0, 14, 0, 60),
        Visible = false,
        ClipsDescendants = true
    }, c)
    new("UICorner", { CornerRadius = UDim.new(0, 8) }, list)
    new("UIStroke", { Color = Color3.fromRGB(80, 80, 110), Thickness = 1, Transparency = 0.35 }, list)
    local uiList = new("UIListLayout", {
        Padding = UDim.new(0, 4),
        SortOrder = Enum.SortOrder.LayoutOrder
    }, list)
    new("UIPadding", { PaddingTop = UDim.new(0, 6), PaddingBottom = UDim.new(0, 6), PaddingLeft = UDim.new(0, 6), PaddingRight = UDim.new(0, 6) }, list)

    local function setOpen(v)
        open = v
        list.Visible = v
        list.Size = v and UDim2.fromOffset(170, 6 + #options * 30 + (#options-1)*4 + 6) or UDim2.fromOffset(170, 0)
    end

    local function setSelected(opt)
        selected = opt
        header.Text = opt .. "  β–Ύ"
        print("[Defy UI] Dropdown selected:", opt)
        setOpen(false)
    end

    for _, opt in ipairs(options) do
        local item = new("TextButton", {
            Text = opt,
            Font = Enum.Font.Gotham,
            TextSize = 14,
            TextColor3 = Color3.fromRGB(230, 230, 240),
            AutoButtonColor = true,
            BackgroundColor3 = Color3.fromRGB(50, 50, 70),
            Size = UDim2.new(1, -12, 0, 30),
            BackgroundTransparency = 0
        }, list)
        new("UICorner", { CornerRadius = UDim.new(0, 6) }, item)
        item.MouseButton1Click:Connect(function() setSelected(opt) end)
    end

    header.MouseButton1Click:Connect(function() setOpen(not open) end)
    setOpen(false)
end

-- SLIDER (0–100)
do
    local c = card("Slider (0–100)")
    local value = 25
    local min, max = 0, 100
    local dragging = false

    local bar = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(45, 45, 65),
        Size = UDim2.fromOffset(170, 8),
        Position = UDim2.new(0, 14, 0, 46),
        BorderSizePixel = 0
    }, c)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, bar)

    local fill = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(120, 170, 255),
        Size = UDim2.fromScale((value-min)/(max-min), 1),
        BorderSizePixel = 0
    }, bar)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, fill)

    local knob = new("Frame", {
        BackgroundColor3 = Color3.fromRGB(235, 235, 245),
        Size = UDim2.fromOffset(16, 16),
        AnchorPoint = Vector2.new(0.5, 0.5),
        Position = UDim2.new((value-min)/(max-min), 0, 0.5, 0),
        BorderSizePixel = 0
    }, bar)
    new("UICorner", { CornerRadius = UDim.new(1, 0) }, knob)

    local valLabel = new("TextLabel", {
        BackgroundTransparency = 1,
        Text = tostring(value),
        Font = Enum.Font.Gotham,
        TextSize = 14,
        TextColor3 = Color3.fromRGB(220, 220, 235),
        Size = UDim2.fromOffset(40, 20),
        Position = UDim2.new(0, 14, 0, 20),
        TextXAlignment = Enum.TextXAlignment.Left
    }, c)

    local function setValue(v)
        v = math.clamp(math.floor(v + 0.5), min, max)
        value = v
        local alpha = (v - min) / (max - min)
        fill.Size = UDim2.fromScale(alpha, 1)
        knob.Position = UDim2.new(alpha, 0, 0.5, 0)
        valLabel.Text = tostring(v)
        -- callback here:
        -- print("[Defy UI] Slider:", v)
    end

    local function updateFromInput(x)
        local absPos = bar.AbsolutePosition.X
        local absSize = bar.AbsoluteSize.X
        local alpha = (x - absPos) / math.max(1, absSize)
        setValue(min + alpha * (max - min))
    end

    bar.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            updateFromInput(input.Position.X)
        end
    end)
    bar.InputEnded:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = false
        end
    end)
    UIS.InputChanged:Connect(function(input)
        if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
            updateFromInput(input.Position.X)
        end
    end)

    setValue(value)
end

Features & Information

Idk free GUI ig

Community Comments (2)

zxcvzxcvAug 18, 2025

now turn it as UI library 😈😈

BopIsmeBopIsmeAug 18, 2025

Rayfield,obsidian,tora library:❌ Random custom gui:βœ…βœ…βœ…

More Scripts for Universal Scripts