Arc Gui hub
Key RequiredUniversal

Arc Gui hub

Universal Scriptbobjsbobjs 178 views 1K executesUpdated Aug 12, 2026
Unrated
00
Lua Script•738 lines (25824 chars)
--[[
    ╔══════════════════════════════════════════════╗
    ║     L I Q U I D   G L A S S   v8.9   UI      ║
    ║        3D Raycast SurfaceGui Sliders         ║
    ║            Credits: @Hamster_Gramer14        ║
    ╚══════════════════════════════════════════════╝
    - Converted slider logic to 3D raycasting for SurfaceGuis
    - Zero position jumping / offset on click & drag
    - Ascension Background Preset retained
    - Background Transparency Slider
    - Custom Asset ID Importer
    - Toggle Key: 'K'
--]]

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

-- ============================================================
-- CONFIG & OPTICS
-- ============================================================
local W, H = 2.8, 1.8          -- 3D Surface Dimensions
local D = 0.04                 -- Primary Glass Thickness
local DISTANCE = 2.2           -- Camera Distance
local TOGGLE_KEY = Enum.KeyCode.K

-- Physics Setup
local SPRING_STIFFNESS = 180
local SPRING_DAMPING = 16
local panelOffset = Vector3.new(0, 0, -DISTANCE)
local currentVel = Vector3.new()
local libraryVisible = true

-- ============================================================
-- CLEANUP PREVIOUS INSTANCES
-- ============================================================
local existingFolder = workspace:FindFirstChild("LiquidGlass_Library_Folder")
if existingFolder then existingFolder:Destroy() end

local existingGui = PlayerGui:FindFirstChild("LiquidGlass_PlayerGui")
if existingGui then existingGui:Destroy() end

local folder = Instance.new("Folder")
folder.Name = "LiquidGlass_Library_Folder"
folder.Parent = workspace

-- ============================================================
-- 3D GLASS BASE
-- ============================================================
local glassPart = Instance.new("Part")
glassPart.Name = "GlassBase"
glassPart.Material = Enum.Material.Glass
glassPart.Color = Color3.fromRGB(255, 255, 255)
glassPart.Transparency = 2.0
glassPart.Anchored = true
glassPart.CanCollide = false
glassPart.CanQuery = true
glassPart.CanTouch = false
glassPart.CastShadow = false
glassPart.Size = Vector3.new(W, H, D)
glassPart.Parent = folder

local glassMesh = Instance.new("SpecialMesh")
glassMesh.MeshType = Enum.MeshType.Brick
glassMesh.Scale = Vector3.new(1.05, 1.05, -1)
glassMesh.Parent = glassPart

local hl = Instance.new("Highlight")
hl.Name = "RefractionForce"
hl.FillTransparency = 1
hl.OutlineTransparency = 1
hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
hl.Adornee = glassPart
hl.Parent = glassPart

-- UI Attachment Target
local overlayPart = Instance.new("Part")
overlayPart.Name = "UIOverlay"
overlayPart.Material = Enum.Material.SmoothPlastic
overlayPart.Transparency = 1
overlayPart.Anchored = true
overlayPart.CanCollide = false
overlayPart.CanQuery = true
overlayPart.CanTouch = false
overlayPart.CastShadow = false
overlayPart.Size = Vector3.new(W, H, 0.001)
overlayPart.Parent = folder

-- ============================================================
-- PERSISTENT SURFACE GUI
-- ============================================================
local surfaceGui = Instance.new("SurfaceGui")
surfaceGui.Name = "LiquidGlass_PlayerGui"
surfaceGui.Face = Enum.NormalId.Back
surfaceGui.CanvasSize = Vector2.new(1400, 900)
surfaceGui.LightInfluence = 0
surfaceGui.AlwaysOnTop = true
surfaceGui.ResetOnSpawn = false
surfaceGui.Adornee = overlayPart
surfaceGui.Parent = PlayerGui

-- Main UI Base Frame
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.fromScale(1, 1)
mainFrame.BackgroundTransparency = 1
mainFrame.Parent = surfaceGui

-- PRESET BACKGROUND IMAGE LAYER
local bgImage = Instance.new("ImageLabel")
bgImage.Name = "CustomBackgroundImage"
bgImage.Size = UDim2.fromScale(1, 1)
bgImage.Position = UDim2.fromScale(0, 0)
bgImage.BackgroundTransparency = 1
bgImage.Image = "rbxassetid://18204680879"
bgImage.ImageTransparency = 0.2
bgImage.ScaleType = Enum.ScaleType.Crop
bgImage.ZIndex = 1
bgImage.Parent = mainFrame

local bgCorner = Instance.new("UICorner")
bgCorner.CornerRadius = UDim.new(0, 28)
bgCorner.Parent = bgImage

-- Rim Border
local rimStroke = Instance.new("UIStroke")
rimStroke.Thickness = 4
rimStroke.Color = Color3.fromRGB(255, 255, 255)
rimStroke.Transparency = 0.25
rimStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
rimStroke.Parent = mainFrame

local rimCorner = Instance.new("UICorner")
rimCorner.CornerRadius = UDim.new(0, 28)
rimCorner.Parent = mainFrame

-- Title
local headerTitle = Instance.new("TextLabel")
headerTitle.Size = UDim2.new(1, -50, 0, 75)
headerTitle.Position = UDim2.new(0, 30, 0, 20)
headerTitle.BackgroundTransparency = 1
headerTitle.Font = Enum.Font.GothamBold
headerTitle.Text = "LIQUID GLASS v8.9  •  REFRACTION UI"
headerTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
headerTitle.TextSize = 32
headerTitle.TextXAlignment = Enum.TextXAlignment.Left
headerTitle.ZIndex = 50
headerTitle.Parent = mainFrame

-- Sidebar
local tabNav = Instance.new("Frame")
tabNav.Size = UDim2.new(0, 280, 1, -130)
tabNav.Position = UDim2.new(0, 30, 0, 105)
tabNav.BackgroundTransparency = 1
tabNav.ZIndex = 50
tabNav.Parent = mainFrame

local tabNavLayout = Instance.new("UIListLayout")
tabNavLayout.Padding = UDim.new(0, 16)
tabNavLayout.SortOrder = Enum.SortOrder.LayoutOrder
tabNavLayout.Parent = tabNav

-- Content Viewport
local contentArea = Instance.new("Frame")
contentArea.Size = UDim2.new(1, -360, 1, -130)
contentArea.Position = UDim2.new(0, 330, 0, 105)
contentArea.BackgroundTransparency = 1
contentArea.ZIndex = 50
contentArea.Parent = mainFrame

-- ============================================================
-- STABLE 3D GLASS INSTANTIATOR
-- ============================================================
local button3DParts = {}

local function attach3DRefractionGlass(guiElement)
    local elementPart = Instance.new("Part")
    elementPart.Name = "ComponentGlass3D"
    elementPart.Material = Enum.Material.Glass
    elementPart.Color = Color3.fromRGB(255, 255, 255)
    elementPart.Transparency = 2.0
    elementPart.Anchored = true
    elementPart.CanCollide = false
    elementPart.CanQuery = false
    elementPart.CastShadow = false
    elementPart.Size = Vector3.new(0.1, 0.1, 0.008)
    elementPart.Parent = folder

    local mesh = Instance.new("SpecialMesh")
    mesh.MeshType = Enum.MeshType.Brick
    mesh.Scale = Vector3.new(1.01, 1.01, -1)
    mesh.Parent = elementPart

    local elementHl = Instance.new("Highlight")
    elementHl.FillTransparency = 1
    elementHl.OutlineTransparency = 1
    elementHl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
    elementHl.Adornee = elementPart
    elementHl.Parent = elementPart

    table.insert(button3DParts, {part = elementPart, gui = guiElement})
end

-- ============================================================
-- 3D RAYCAST UTILITY FOR SURFACEGUI INPUTS
-- ============================================================
local function get3DSurfaceGuiHitX(guiElement)
    local cam = workspace.CurrentCamera
    if not cam then return nil end

    local mousePos = UserInputService:GetMouseLocation()
    local unitRay = cam:ScreenPointToRay(mousePos.X, mousePos.Y)

    local rayParams = RaycastParams.new()
    rayParams.FilterType = Enum.RaycastFilterType.Include
    rayParams.FilterDescendantsInstances = {overlayPart}

    local result = workspace:Raycast(unitRay.Origin, unitRay.Direction * 100, rayParams)
    if not result then return nil end

    local localHit = overlayPart.CFrame:PointToObjectSpace(result.Position)
    local u = (localHit.X / W) + 0.5
    local v = 0.5 - (localHit.Y / H)

    local hitCanvasX = u * surfaceGui.CanvasSize.X
    local trackAbsX = guiElement.AbsolutePosition.X
    local trackWidth = guiElement.AbsoluteSize.X

    if trackWidth <= 0 then return nil end
    return math.clamp((hitCanvasX - trackAbsX) / trackWidth, 0, 1)
end

local activeSliders = {}

local tabButtons = {}
local Library = {}

function Library:CreateTab(name)
    local tabScroll = Instance.new("ScrollingFrame")
    tabScroll.Name = name .. "Tab"
    tabScroll.Size = UDim2.fromScale(1, 1)
    tabScroll.BackgroundTransparency = 1
    tabScroll.ScrollBarThickness = 8
    tabScroll.ScrollBarImageColor3 = Color3.fromRGB(0, 180, 255)
    tabScroll.Visible = false
    tabScroll.ZIndex = 50
    tabScroll.Parent = contentArea

    local scrollLayout = Instance.new("UIListLayout")
    scrollLayout.Padding = UDim.new(0, 18)
    scrollLayout.SortOrder = Enum.SortOrder.LayoutOrder
    scrollLayout.Parent = tabScroll

    local tabBtn = Instance.new("TextButton")
    tabBtn.Size = UDim2.new(1, 0, 0, 60)
    tabBtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
    tabBtn.BackgroundTransparency = 0.88
    tabBtn.Font = Enum.Font.GothamBold
    tabBtn.Text = name
    tabBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
    tabBtn.TextSize = 22
    tabBtn.ZIndex = 50
    tabBtn.Parent = tabNav

    local btnCorner = Instance.new("UICorner")
    btnCorner.CornerRadius = UDim.new(0, 14)
    btnCorner.Parent = tabBtn

    local tabStroke = Instance.new("UIStroke")
    tabStroke.Thickness = 2
    tabStroke.Color = Color3.fromRGB(255, 255, 255)
    tabStroke.Transparency = 0.5
    tabStroke.Parent = tabBtn

    attach3DRefractionGlass(tabBtn)
    table.insert(tabButtons, {btn = tabBtn, tab = tabScroll, stroke = tabStroke})

    local function selectTab()
        for _, item in ipairs(tabButtons) do
            item.tab.Visible = false
            item.btn.BackgroundTransparency = 0.88
            item.stroke.Transparency = 0.5
        end
        tabScroll.Visible = true
        tabBtn.BackgroundTransparency = 0.65
        tabStroke.Transparency = 0.1
    end

    tabBtn.MouseButton1Click:Connect(selectTab)
    if #tabButtons == 1 then selectTab() end

    local TabElements = {}
    TabElements.tabScroll = tabScroll

    -- 3D Interactive Button
    function TabElements:AddButton(text, callback)
        local btn = Instance.new("TextButton")
        btn.Size = UDim2.new(1, -20, 0, 65)
        btn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        btn.BackgroundTransparency = 0.88
        btn.Font = Enum.Font.GothamBold
        btn.Text = text
        btn.TextColor3 = Color3.fromRGB(255, 255, 255)
        btn.TextSize = 20
        btn.ZIndex = 50
        btn.Parent = tabScroll

        local btnCorner = Instance.new("UICorner")
        btnCorner.CornerRadius = UDim.new(0, 14)
        btnCorner.Parent = btn

        local bStroke = Instance.new("UIStroke")
        bStroke.Thickness = 2
        bStroke.Color = Color3.fromRGB(255, 255, 255)
        bStroke.Transparency = 0.5
        bStroke.Parent = btn

        attach3DRefractionGlass(btn)
        btn.MouseButton1Click:Connect(callback)
    end

    -- 3D Interactive Toggle
    function TabElements:AddToggle(text, defaultState, callback)
        local frame = Instance.new("Frame")
        frame.Size = UDim2.new(1, -20, 0, 65)
        frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        frame.BackgroundTransparency = 0.88
        frame.ZIndex = 50
        frame.Parent = tabScroll

        local fCorner = Instance.new("UICorner")
        fCorner.CornerRadius = UDim.new(0, 14)
        fCorner.Parent = frame

        local fStroke = Instance.new("UIStroke")
        fStroke.Thickness = 2
        fStroke.Color = Color3.fromRGB(255, 255, 255)
        fStroke.Transparency = 0.5
        fStroke.Parent = frame

        local lbl = Instance.new("TextLabel")
        lbl.Size = UDim2.new(0.7, 0, 1, 0)
        lbl.Position = UDim2.new(0, 25, 0, 0)
        lbl.BackgroundTransparency = 1
        lbl.Font = Enum.Font.GothamBold
        lbl.Text = text
        lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
        lbl.TextSize = 20
        lbl.TextXAlignment = Enum.TextXAlignment.Left
        lbl.ZIndex = 51
        lbl.Parent = frame

        local tBtn = Instance.new("TextButton")
        tBtn.Size = UDim2.new(0, 75, 0, 36)
        tBtn.Position = UDim2.new(1, -100, 0.5, -18)
        tBtn.BackgroundColor3 = defaultState and Color3.fromRGB(0, 180, 255) or Color3.fromRGB(90, 90, 90)
        tBtn.Text = ""
        tBtn.ZIndex = 51
        tBtn.Parent = frame

        local tCorner = Instance.new("UICorner")
        tCorner.CornerRadius = UDim.new(1, 0)
        tCorner.Parent = tBtn

        attach3DRefractionGlass(frame)

        local state = defaultState
        tBtn.MouseButton1Click:Connect(function()
            state = not state
            tBtn.BackgroundColor3 = state and Color3.fromRGB(0, 180, 255) or Color3.fromRGB(90, 90, 90)
            callback(state)
        end)
    end

    -- FIXED 3D RAYCAST SLIDER
    function TabElements:AddSlider(text, minVal, maxVal, defaultVal, callback)
        local frame = Instance.new("Frame")
        frame.Size = UDim2.new(1, -20, 0, 85)
        frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        frame.BackgroundTransparency = 0.88
        frame.ZIndex = 50
        frame.Parent = tabScroll

        local fCorner = Instance.new("UICorner")
        fCorner.CornerRadius = UDim.new(0, 14)
        fCorner.Parent = frame

        local fStroke = Instance.new("UIStroke")
        fStroke.Thickness = 2
        fStroke.Color = Color3.fromRGB(255, 255, 255)
        fStroke.Transparency = 0.5
        fStroke.Parent = frame

        local lbl = Instance.new("TextLabel")
        lbl.Size = UDim2.new(1, -40, 0, 30)
        lbl.Position = UDim2.new(0, 20, 0, 10)
        lbl.BackgroundTransparency = 1
        lbl.Font = Enum.Font.GothamBold
        lbl.Text = string.format("%s: %.2f", text, defaultVal)
        lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
        lbl.TextSize = 20
        lbl.TextXAlignment = Enum.TextXAlignment.Left
        lbl.ZIndex = 51
        lbl.Parent = frame

        local track = Instance.new("Frame")
        track.Size = UDim2.new(1, -40, 0, 18)
        track.Position = UDim2.new(0, 20, 0, 50)
        track.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
        track.ZIndex = 51
        track.Parent = frame

        local trCorner = Instance.new("UICorner")
        trCorner.CornerRadius = UDim.new(0, 9)
        trCorner.Parent = track

        local fill = Instance.new("Frame")
        local alpha = math.clamp((defaultVal - minVal) / (maxVal - minVal), 0, 1)
        fill.Size = UDim2.new(alpha, 0, 1, 0)
        fill.BackgroundColor3 = Color3.fromRGB(0, 180, 255)
        fill.BorderSizePixel = 0
        fill.ZIndex = 52
        fill.Parent = track

        local fillCorner = Instance.new("UICorner")
        fillCorner.CornerRadius = UDim.new(0, 9)
        fillCorner.Parent = fill

        local trigger = Instance.new("TextButton")
        trigger.Size = UDim2.fromScale(1, 1)
        trigger.BackgroundTransparency = 1
        trigger.Text = ""
        trigger.ZIndex = 53
        trigger.Parent = track

        attach3DRefractionGlass(frame)

        local sliderData = {
            sliding = false,
            track = track,
            update = function()
                local alphaHit = get3DSurfaceGuiHitX(track)
                if alphaHit then
                    fill.Size = UDim2.new(alphaHit, 0, 1, 0)
                    local currentVal = minVal + alphaHit * (maxVal - minVal)
                    lbl.Text = string.format("%s: %.2f", text, currentVal)
                    callback(currentVal)
                end
            end
        }

        table.insert(activeSliders, sliderData)

        trigger.MouseButton1Down:Connect(function()
            sliderData.sliding = true
            sliderData.update()
        end)
    end

    -- Image Input Box
    function TabElements:AddImageInput(placeholderText, callback)
        local frame = Instance.new("Frame")
        frame.Size = UDim2.new(1, -20, 0, 85)
        frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        frame.BackgroundTransparency = 0.88
        frame.ZIndex = 50
        frame.Parent = tabScroll

        local fCorner = Instance.new("UICorner")
        fCorner.CornerRadius = UDim.new(0, 14)
        fCorner.Parent = frame

        local fStroke = Instance.new("UIStroke")
        fStroke.Thickness = 2
        fStroke.Color = Color3.fromRGB(255, 255, 255)
        fStroke.Transparency = 0.5
        fStroke.Parent = frame

        local lbl = Instance.new("TextLabel")
        lbl.Size = UDim2.new(1, -40, 0, 25)
        lbl.Position = UDim2.new(0, 20, 0, 8)
        lbl.BackgroundTransparency = 1
        lbl.Font = Enum.Font.GothamBold
        lbl.Text = "Custom Decal Asset ID Importer"
        lbl.TextColor3 = Color3.fromRGB(255, 255, 255)
        lbl.TextSize = 18
        lbl.TextXAlignment = Enum.TextXAlignment.Left
        lbl.ZIndex = 51
        lbl.Parent = frame

        local textBox = Instance.new("TextBox")
        textBox.Size = UDim2.new(1, -40, 0, 36)
        textBox.Position = UDim2.new(0, 20, 0, 38)
        textBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
        textBox.BackgroundTransparency = 0.3
        textBox.Font = Enum.Font.Gotham
        textBox.PlaceholderText = placeholderText or "Enter Custom Asset ID"
        textBox.PlaceholderColor3 = Color3.fromRGB(150, 150, 150)
        textBox.Text = ""
        textBox.TextColor3 = Color3.fromRGB(0, 200, 255)
        textBox.TextSize = 18
        textBox.ClearTextOnFocus = false
        textBox.ZIndex = 51
        textBox.Parent = frame

        local tbCorner = Instance.new("UICorner")
        tbCorner.CornerRadius = UDim.new(0, 8)
        tbCorner.Parent = textBox

        attach3DRefractionGlass(frame)

        textBox.FocusLost:Connect(function(enterPressed)
            if textBox.Text ~= "" then
                local formattedId = textBox.Text
                if not string.find(formattedId, "rbxassetid://") then
                    formattedId = "rbxassetid://" .. formattedId
                end
                callback(formattedId)
            end
        end)
    end

    return TabElements
end

-- Global Input Handlers for Sliders
UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
        for _, sData in ipairs(activeSliders) do
            sData.sliding = false
        end
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
        for _, sData in ipairs(activeSliders) do
            if sData.sliding then
                sData.update()
            end
        end
    end
end)

-- ============================================================
-- INITIALIZE CONTROLS
-- ============================================================
local MainTab = Library:CreateTab("Main")
local CustomisationTab = Library:CreateTab("Customisation")
local SettingsTab = Library:CreateTab("Settings")

-- Main Tab
MainTab:AddToggle("Auto Farm", false, function(v) print("Auto Farm:", v) end)
MainTab:AddToggle("Kill Aura", true, function(v) print("Kill Aura:", v) end)
MainTab:AddSlider("WalkSpeed", 16, 150, 32, function(v) print("Speed:", v) end)
MainTab:AddButton("Teleport To Spawn", function() print("Teleported!") end)

-- Customisation Tab
CustomisationTab:AddButton("Set Theme: Ascending Dummy", function()
    bgImage.Image = "rbxassetid://18204680879"
    if bgImage.ImageTransparency >= 1 then
        bgImage.ImageTransparency = 0.2
    end
    print("Background set to Ascending Dummy")
end)

CustomisationTab:AddButton("Clear Background Image", function()
    bgImage.ImageTransparency = 1
end)

CustomisationTab:AddSlider("Background Transparency", 0, 1, 0.2, function(val)
    bgImage.ImageTransparency = val
end)

CustomisationTab:AddImageInput("Paste custom Asset ID...", function(assetId)
    bgImage.Image = assetId
    if bgImage.ImageTransparency >= 1 then
        bgImage.ImageTransparency = 0.2
    end
    print("Loaded Custom Background ID:", assetId)
end)

-- Settings Tab
SettingsTab:AddButton("Reset Settings", function() print("Resetting...") end)

local creditBox = Instance.new("Frame")
creditBox.Size = UDim2.new(1, -20, 0, 85)
creditBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
creditBox.BackgroundTransparency = 0.88
creditBox.ZIndex = 50
creditBox.Parent = SettingsTab.tabScroll

local cCorner = Instance.new("UICorner")
cCorner.CornerRadius = UDim.new(0, 14)
cCorner.Parent = creditBox

local cStroke = Instance.new("UIStroke")
cStroke.Thickness = 2
cStroke.Color = Color3.fromRGB(255, 255, 255)
cStroke.Transparency = 0.5
cStroke.Parent = creditBox

local creditLabel = Instance.new("TextLabel")
creditLabel.Size = UDim2.fromScale(1, 1)
creditLabel.BackgroundTransparency = 1
creditLabel.Font = Enum.Font.GothamBold
creditLabel.Text = "UI Library Credits:\n@Hamster_Gramer14"
creditLabel.TextColor3 = Color3.fromRGB(0, 200, 255)
creditLabel.TextSize = 20
creditLabel.ZIndex = 51
creditLabel.Parent = creditBox

attach3DRefractionGlass(creditBox)

-- ============================================================
-- RESPAWN RE-HOOKING & RENDER ENGINE
-- ============================================================
LocalPlayer.CharacterAdded:Connect(function()
    task.wait(0.3)
    if surfaceGui and overlayPart then
        surfaceGui.Adornee = overlayPart
    end
end)

UserInputService.InputBegan:Connect(function(input, processed)
    if processed then return end
    if input.KeyCode == TOGGLE_KEY then
        libraryVisible = not libraryVisible
        glassPart.Transparency = libraryVisible and 2.0 or 1.0
        overlayPart.Transparency = 1.0
        surfaceGui.Enabled = libraryVisible
        for _, elem in ipairs(button3DParts) do
            elem.part.Transparency = libraryVisible and 2.0 or 1.0
        end
    end
end)

local dragging = false
local targetOffset = panelOffset
local dragOffsetLocal = Vector3.new()
local partList = {glassPart}

RunService.RenderStepped:Connect(function(dt)
    if not libraryVisible then return end
    local cam = workspace.CurrentCamera
    if not cam then return end

    local force = (targetOffset - panelOffset) * SPRING_STIFFNESS
    currentVel = (currentVel + force * dt) * (1 - SPRING_DAMPING * dt)
    panelOffset = panelOffset + currentVel * dt

    local tiltX = math.clamp(-currentVel.Y * 0.12, -10, 10)
    local tiltY = math.clamp(currentVel.X * 0.12, -10, 10)
    local tiltCF = CFrame.Angles(math.rad(tiltX), math.rad(tiltY), 0)

    local baseCF = cam.CFrame * CFrame.new(panelOffset) * tiltCF
    glassPart.CFrame = baseCF
    overlayPart.CFrame = baseCF * CFrame.new(0, 0, D/2 + 0.002)

    -- Component Glass Placement
    local canvasSize = surfaceGui.CanvasSize
    for _, item in ipairs(button3DParts) do
        if item.gui and item.gui.Visible and item.gui:IsDescendantOf(surfaceGui) then
            local pos = item.gui.AbsolutePosition - mainFrame.AbsolutePosition
            local size = item.gui.AbsoluteSize

            local relX = (pos.X + size.X/2) / canvasSize.X - 0.5
            local relY = 0.5 - (pos.Y + size.Y/2) / canvasSize.Y

            local localPos = Vector3.new(relX * W, relY * H, -0.008)
            item.part.CFrame = baseCF * CFrame.new(localPos)
            item.part.Size = Vector3.new((size.X / canvasSize.X) * W, (size.Y / canvasSize.Y) * H, 0.008)
        end
    end
end)

-- Physics Dragging
UserInputService.InputBegan:Connect(function(input, processed)
    if processed or not libraryVisible then return end
    if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end

    -- Avoid dragging full UI frame if currently grabbing a slider
    for _, sData in ipairs(activeSliders) do
        if sData.sliding then return end
    end

    local cam = workspace.CurrentCamera
    if not cam then return end

    local mousePos = UserInputService:GetMouseLocation()
    local unitRay = cam:ScreenPointToRay(mousePos.X, mousePos.Y)

    local rayParams = RaycastParams.new()
    rayParams.FilterType = Enum.RaycastFilterType.Include
    rayParams.FilterDescendantsInstances = partList

    local result = workspace:Raycast(unitRay.Origin, unitRay.Direction * 100, rayParams)
    if result then
        dragging = true
        local centerWorld = (cam.CFrame * CFrame.new(panelOffset)).Position
        dragOffsetLocal = cam.CFrame:VectorToObjectSpace(result.Position - centerWorld)
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if not dragging or not libraryVisible or input.UserInputType ~= Enum.UserInputType.MouseMovement then return end

    local cam = workspace.CurrentCamera
    if not cam then return end

    local mousePos = UserInputService:GetMouseLocation()
    local unitRay = cam:ScreenPointToRay(mousePos.X, mousePos.Y)

    local planePoint  = (cam.CFrame * CFrame.new(panelOffset)).Position
    local planeNormal = cam.CFrame.LookVector

    local denom = unitRay.Direction:Dot(planeNormal)
    if math.abs(denom) < 1e-6 then return end
    local t = (planePoint - unitRay.Origin):Dot(planeNormal) / denom
    if t < 0 then return end

    local hitPoint = unitRay.Origin + unitRay.Direction * t
    local worldOffset = cam.CFrame:VectorToWorldSpace(dragOffsetLocal)
    local newCenter = hitPoint - worldOffset
    local localNew = cam.CFrame:VectorToObjectSpace(newCenter - cam.CFrame.Position)
    targetOffset = Vector3.new(localNew.X, localNew.Y, -DISTANCE)
end)

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

print("[LiquidGlass v8.9] Loaded // 3D SurfaceGui Raycast Sliders Fixed // Credits: @Hamster_Gramer14")

Features & Information

eh a cool ui i guess, just like apples liquid glass
#liquid gl*#gui#library#liquid#arc

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts