-- Optihub (Single LocalScript) -- Embedded top bar drag, full-screen blur confirmation, off-screen bottom restore bar (any part off-screen) -- Place in StarterPlayerScripts as a LocalScript local Players = game:GetService("Players") local UIS = game:GetService("UserInputService") local RunService = game:GetService("RunService") local Lighting = game:GetService("Lighting") local player = Players.LocalPlayer local pg = player:WaitForChild("PlayerGui") local function destroy(obj) if obj and obj.Parent then obj:Destroy() end end -- Helper: create UICorner quickly local function corner(parent, radius) local c = Instance.new("UICorner", parent) c.CornerRadius = UDim.new(0, radius or 6) return c end -- Initial "Run Optihub?" popup local promptGui = Instance.new("ScreenGui", pg) promptGui.Name = "OptihubPrompt" promptGui.DisplayOrder = 999999 local promptFrame = Instance.new("Frame", promptGui) promptFrame.Size = UDim2.new(0, 320, 0, 160) promptFrame.Position = UDim2.new(0.5, -160, 0.5, -80) promptFrame.BackgroundColor3 = Color3.fromRGB(15, 20, 30) promptFrame.BackgroundTransparency = 0.05 promptFrame.BorderSizePixel = 0 corner(promptFrame, 8) local promptText = Instance.new("TextLabel", promptFrame) promptText.Size = UDim2.new(1, -24, 0, 72) promptText.Position = UDim2.new(0, 12, 0, 12) promptText.BackgroundTransparency = 1 promptText.Text = "Do you want to run Optihub?" promptText.TextColor3 = Color3.fromRGB(210, 230, 255) promptText.TextSize = 20 promptText.Font = Enum.Font.GothamMedium promptText.TextWrapped = true local yesBtn = Instance.new("TextButton", promptFrame) yesBtn.Size = UDim2.new(0.45, 0, 0, 40) yesBtn.Position = UDim2.new(0.05, 0, 1, -52) yesBtn.BackgroundColor3 = Color3.fromRGB(0, 70, 130) yesBtn.BackgroundTransparency = 0.05 yesBtn.Text = "Yes" yesBtn.TextColor3 = Color3.fromRGB(210, 230, 255) yesBtn.Font = Enum.Font.GothamMedium yesBtn.TextSize = 18 yesBtn.BorderSizePixel = 0 corner(yesBtn, 6) local noBtn = Instance.new("TextButton", promptFrame) noBtn.Size = UDim2.new(0.45, 0, 0, 40) noBtn.Position = UDim2.new(0.5, 0, 1, -52) noBtn.BackgroundColor3 = Color3.fromRGB(130, 30, 30) noBtn.BackgroundTransparency = 0.05 noBtn.Text = "No" noBtn.TextColor3 = Color3.fromRGB(255, 230, 230) noBtn.Font = Enum.Font.GothamMedium noBtn.TextSize = 18 noBtn.BorderSizePixel = 0 corner(noBtn, 6) noBtn.MouseButton1Click:Connect(function() destroy(promptGui) end) -- Main UI creation on Yes yesBtn.MouseButton1Click:Connect(function() destroy(promptGui) -- Main ScreenGui local gui = Instance.new("ScreenGui", pg) gui.Name = "Optihub" gui.DisplayOrder = 999999 -- Main window local win = Instance.new("Frame", gui) win.Name = "Window" win.Size = UDim2.new(0, 580, 0, 380) win.Position = UDim2.new(0.5, -290, 0.5, -190) win.BackgroundColor3 = Color3.fromRGB(12, 18, 28) win.BackgroundTransparency = 0.18 win.BorderSizePixel = 0 win.Active = true corner(win, 8) -- Top bar (embedded visually; drag handled manually) local top = Instance.new("Frame", win) top.Name = "TopBar" top.Size = UDim2.new(1, 0, 0, 44) top.Position = UDim2.new(0, 0, 0, 0) top.BackgroundColor3 = Color3.fromRGB(18, 26, 40) top.BackgroundTransparency = 0.02 top.BorderSizePixel = 0 top.Active = true corner(top, 8) local title = Instance.new("TextLabel", top) title.Size = UDim2.new(1, -140, 1, 0) title.Position = UDim2.new(0, 16, 0, 0) title.BackgroundTransparency = 1 title.Text = "Optihub" title.TextColor3 = Color3.fromRGB(210, 230, 255) title.TextSize = 22 title.Font = Enum.Font.GothamMedium title.TextXAlignment = Enum.TextXAlignment.Left local close = Instance.new("TextButton", top) close.Size = UDim2.new(0, 40, 0, 28) close.Position = UDim2.new(1, -48, 0.5, -14) close.BackgroundColor3 = Color3.fromRGB(0, 70, 130) close.BackgroundTransparency = 0.02 close.Text = "X" close.TextColor3 = Color3.fromRGB(210, 230, 255) close.TextSize = 20 close.Font = Enum.Font.GothamMedium close.BorderSizePixel = 0 corner(close, 6) local min = Instance.new("TextButton", top) min.Size = UDim2.new(0, 40, 0, 28) min.Position = UDim2.new(1, -92, 0.5, -14) min.BackgroundColor3 = Color3.fromRGB(0, 70, 130) min.BackgroundTransparency = 0.02 min.Text = "-" min.TextColor3 = Color3.fromRGB(210, 230, 255) min.TextSize = 26 min.Font = Enum.Font.GothamMedium min.BorderSizePixel = 0 corner(min, 6) -- Body local body = Instance.new("Frame", win) body.Size = UDim2.new(1, 0, 1, -44) body.Position = UDim2.new(0, 0, 0, 44) body.BackgroundTransparency = 1 -- Tabs area local tabHolder = Instance.new("Frame", body) tabHolder.Size = UDim2.new(0, 160, 1, -30) tabHolder.Position = UDim2.new(0, 15, 0, 15) tabHolder.BackgroundColor3 = Color3.fromRGB(18, 24, 38) tabHolder.BackgroundTransparency = 0.08 tabHolder.BorderSizePixel = 0 corner(tabHolder, 6) local tabScroll = Instance.new("ScrollingFrame", tabHolder) tabScroll.Size = UDim2.new(1, 0, 1, 0) tabScroll.CanvasSize = UDim2.new(0, 0, 0, 0) tabScroll.ScrollBarThickness = 4 tabScroll.BackgroundTransparency = 1 local tabList = Instance.new("UIListLayout", tabScroll) tabList.Padding = UDim.new(0, 10) tabList.FillDirection = Enum.FillDirection.Vertical tabList.HorizontalAlignment = Enum.HorizontalAlignment.Center tabList.SortOrder = Enum.SortOrder.LayoutOrder local pages = Instance.new("Frame", body) pages.Size = UDim2.new(1, -200, 1, -30) pages.Position = UDim2.new(0, 190, 0, 15) pages.BackgroundTransparency = 1 local Tabs = {} local currentPage = nil local function updateScroll() tabScroll.CanvasSize = UDim2.new(0, 0, 0, tabList.AbsoluteContentSize.Y + 10) end tabList:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateScroll) -- Confirmation popup with full-screen blur local function confirmRun(callback) -- Add blur local blur = Instance.new("BlurEffect") blur.Name = "OptihubBlur" blur.Size = 18 blur.Parent = Lighting -- Modal GUI local modal = Instance.new("ScreenGui", pg) modal.DisplayOrder = 9999999 modal.Name = "OptihubConfirm" local frame = Instance.new("Frame", modal) frame.Size = UDim2.new(0, 360, 0, 180) frame.Position = UDim2.new(0.5, -180, 0.5, -90) frame.BackgroundColor3 = Color3.fromRGB(15, 20, 30) frame.BackgroundTransparency = 0.05 frame.BorderSizePixel = 0 corner(frame, 8) local label = Instance.new("TextLabel", frame) label.Size = UDim2.new(1, -24, 0, 80) label.Position = UDim2.new(0, 12, 0, 12) label.BackgroundTransparency = 1 label.Text = "Are you sure you want to run this script?" label.TextColor3 = Color3.fromRGB(210, 230, 255) label.TextSize = 20 label.Font = Enum.Font.GothamMedium label.TextWrapped = true local yes = Instance.new("TextButton", frame) yes.Size = UDim2.new(0.45, 0, 0, 44) yes.Position = UDim2.new(0.05, 0, 1, -56) yes.BackgroundColor3 = Color3.fromRGB(0, 70, 130) yes.BackgroundTransparency = 0.05 yes.Text = "Yes" yes.TextColor3 = Color3.fromRGB(210, 230, 255) yes.Font = Enum.Font.GothamMedium yes.TextSize = 18 yes.BorderSizePixel = 0 corner(yes, 6) local no = Instance.new("TextButton", frame) no.Size = UDim2.new(0.45, 0, 0, 44) no.Position = UDim2.new(0.5, 0, 1, -56) no.BackgroundColor3 = Color3.fromRGB(130, 30, 30) no.BackgroundTransparency = 0.05 no.Text = "No" no.TextColor3 = Color3.fromRGB(255, 230, 230) no.Font = Enum.Font.GothamMedium no.TextSize = 18 no.BorderSizePixel = 0 corner(no, 6) yes.MouseButton1Click:Connect(function() destroy(modal) if blur and blur.Parent then blur:Destroy() end pcall(callback) end) no.MouseButton1Click:Connect(function() destroy(modal) if blur and blur.Parent then blur:Destroy() end end) end -- Create script button local function createScriptButton(page, name, code) local btn = Instance.new("TextButton", page) btn.Size = UDim2.new(0, 200, 0, 36) btn.BackgroundColor3 = Color3.fromRGB(22, 32, 52) btn.BackgroundTransparency = 0.08 btn.Text = name btn.TextColor3 = Color3.fromRGB(200, 220, 255) btn.TextSize = 18 btn.Font = Enum.Font.GothamMedium btn.BorderSizePixel = 0 corner(btn, 6) btn.MouseButton1Click:Connect(function() confirmRun(function() -- run the script safely pcall(function() loadstring(game:HttpGet(code))() end) end) end) end -- Page creator local function createPage(scripts) local page = Instance.new("ScrollingFrame", pages) page.Size = UDim2.new(1, 0, 1, 0) page.CanvasSize = UDim2.new(0, 0, 0, 0) page.ScrollBarThickness = 4 page.BackgroundTransparency = 1 page.Visible = false local layout = Instance.new("UIListLayout", page) layout.Padding = UDim.new(0, 12) layout.FillDirection = Enum.FillDirection.Vertical layout.HorizontalAlignment = Enum.HorizontalAlignment.Left layout.SortOrder = Enum.SortOrder.LayoutOrder layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function() page.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y + 10) end) for _, info in ipairs(scripts) do createScriptButton(page, info.Name, info.Code) end return page end -- Tab creator local function createTab(name, scripts) local tabFrame = Instance.new("Frame", tabScroll) tabFrame.Size = UDim2.new(1, -20, 0, 36) tabFrame.BackgroundTransparency = 1 local tabButton = Instance.new("TextButton", tabFrame) tabButton.Size = UDim2.new(1, 0, 1, 0) tabButton.BackgroundColor3 = Color3.fromRGB(22, 32, 52) tabButton.BackgroundTransparency = 0.08 tabButton.Text = name tabButton.TextColor3 = Color3.fromRGB(200, 220, 255) tabButton.TextSize = 18 tabButton.Font = Enum.Font.GothamMedium tabButton.BorderSizePixel = 0 corner(tabButton, 6) local page = createPage(scripts) Tabs[tabFrame] = {Button = tabButton, Page = page} tabButton.MouseButton1Click:Connect(function() for _, v in pairs(Tabs) do v.Page.Visible = false end page.Visible = true currentPage = page end) updateScroll() if not currentPage then page.Visible = true currentPage = page end end -- Create General tab with the three scripts createTab("General", { {Name = "Chat Commander", Code = "https://pastebin.com/raw/WLP5Ptst"}, {Name = "Dophin Truss", Code = "https://pastebin.com/raw/5qekNbE7"}, {Name = "Moonshine Shaders", Code = "https://pastebin.com/raw/dNFaqmuj"}, }) -- Example other tabs (placeholders) createTab("Tab 2", { {Name = "Script X", Code = "https://pastebin.com/raw/XXXXXXXX"}, }) createTab("Tab 3", { {Name = "Script 1", Code = "https://pastebin.com/raw/YYYYYYYY"}, }) -- Minimize logic local minimized = false local miniBtn = nil min.MouseButton1Click:Connect(function() if minimized then minimized = false destroy(miniBtn) win.Visible = true else minimized = true win.Visible = false miniBtn = Instance.new("TextButton", gui) miniBtn.Size = UDim2.new(0, 150, 0, 40) miniBtn.Position = UDim2.new(0.5, -75, 0.1, 0) miniBtn.BackgroundColor3 = Color3.fromRGB(0, 70, 130) miniBtn.BackgroundTransparency = 0.05 miniBtn.Text = "Optihub" miniBtn.TextColor3 = Color3.fromRGB(210, 230, 255) miniBtn.TextSize = 20 miniBtn.Font = Enum.Font.GothamMedium miniBtn.BorderSizePixel = 0 miniBtn.Active = true miniBtn.Draggable = true corner(miniBtn, 6) miniBtn.MouseButton1Click:Connect(function() minimized = false destroy(miniBtn) win.Visible = true end) end end) close.MouseButton1Click:Connect(function() destroy(gui) end) -- Dragging: top bar drags the entire window (manual) local dragging = false local dragStart = Vector2.new(0, 0) local startPos = UDim2.new(0, 0, 0, 0) top.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = win.Position end end) top.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 win.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) -- Off-screen detection (any part off-screen) and bottom restore bar local viewportSize = workspace.CurrentCamera and workspace.CurrentCamera.ViewportSize or Vector2.new(1920, 1080) local bottomBar = nil local function isAnyPartOffscreen() -- Use AbsolutePosition and AbsoluteSize for accurate pixel checks local pos = win.AbsolutePosition local size = win.AbsoluteSize local left = pos.X local topY = pos.Y local right = pos.X + size.X local bottom = pos.Y + size.Y viewportSize = workspace.CurrentCamera and workspace.CurrentCamera.ViewportSize or viewportSize if left < 0 or topY < 0 or right > viewportSize.X or bottom > viewportSize.Y then return true end return false end local function showBottomBar() if bottomBar and bottomBar.Parent then return end bottomBar = Instance.new("ScreenGui", pg) bottomBar.Name = "OptihubRestore" bottomBar.DisplayOrder = 9999998 local bar = Instance.new("TextButton", bottomBar) bar.Size = UDim2.new(1, 0, 0, 28) bar.Position = UDim2.new(0, 0, 1, -28) bar.BackgroundColor3 = Color3.fromRGB(10, 14, 20) bar.BackgroundTransparency = 0.05 bar.Text = "Optihub" bar.TextColor3 = Color3.fromRGB(210, 230, 255) bar.Font = Enum.Font.GothamMedium bar.TextSize = 16 bar.BorderSizePixel = 0 bar.MouseButton1Click:Connect(function() -- Restore to center of screen win.Position = UDim2.new(0.5, -win.AbsoluteSize.X/2, 0.5, -win.AbsoluteSize.Y/2) destroy(bottomBar) bottomBar = nil end) end local function hideBottomBar() if bottomBar then destroy(bottomBar) bottomBar = nil end end -- Continuous check (lightweight) local checkConn checkConn = RunService.RenderStepped:Connect(function() -- ensure AbsoluteSize/Position are up-to-date if isAnyPartOffscreen() then if not bottomBar then showBottomBar() end else if bottomBar then hideBottomBar() end end end) -- Clean up when GUI destroyed gui.AncestryChanged:Connect(function() if not gui:IsDescendantOf(game) then if checkConn then checkConn:Disconnect() end if bottomBar then destroy(bottomBar) end local b = Lighting:FindFirstChild("OptihubBlur") if b then b:Destroy() end end end) end)