-- SH V2 HUB (CLOSE + MINIMIZE ADDED) local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") ------------------------------------------------ -- GUI ------------------------------------------------ local gui = Instance.new("ScreenGui") gui.Parent = playerGui gui.ResetOnSpawn = false ------------------------------------------------ -- OPEN BUTTON ------------------------------------------------ local openBtn = Instance.new("TextButton") openBtn.Size = UDim2.new(0,80,0,80) openBtn.Position = UDim2.new(0.05,0,0.4,0) openBtn.BackgroundColor3 = Color3.fromRGB(10,10,10) openBtn.Text = "S" openBtn.TextColor3 = Color3.fromRGB(255,255,255) openBtn.TextScaled = true openBtn.Parent = gui Instance.new("UICorner", openBtn).CornerRadius = UDim.new(0,20) local stroke1 = Instance.new("UIStroke", openBtn) stroke1.Color = Color3.fromRGB(255,255,255) stroke1.Thickness = 2 ------------------------------------------------ -- HUB ------------------------------------------------ local hub = Instance.new("Frame") hub.Size = UDim2.new(0,450,0,300) hub.Position = UDim2.new(0.5,0,0.5,0) hub.AnchorPoint = Vector2.new(0.5,0.5) hub.BackgroundColor3 = Color3.fromRGB(10,10,10) hub.Visible = false hub.Parent = gui Instance.new("UICorner", hub).CornerRadius = UDim.new(0,12) local stroke2 = Instance.new("UIStroke", hub) stroke2.Color = Color3.fromRGB(255,255,255) stroke2.Thickness = 2 local grad = Instance.new("UIGradient", hub) grad.Color = ColorSequence.new{ ColorSequenceKeypoint.new(0, Color3.fromRGB(0,0,0)), ColorSequenceKeypoint.new(0.5, Color3.fromRGB(25,25,25)), ColorSequenceKeypoint.new(1, Color3.fromRGB(0,0,0)) } ------------------------------------------------ -- TOP BAR ------------------------------------------------ local topBar = Instance.new("Frame") topBar.Size = UDim2.new(1,0,0,40) topBar.BackgroundColor3 = Color3.fromRGB(5,5,5) topBar.Parent = hub local topStroke = Instance.new("UIStroke", topBar) topStroke.Color = Color3.fromRGB(255,255,255) topStroke.Thickness = 1.5 local title = Instance.new("TextLabel") title.Size = UDim2.new(1,0,1,0) title.BackgroundTransparency = 1 title.Text = "SH V2 HUB MADE BY SHIVA (FREE VERSION)" title.TextColor3 = Color3.fromRGB(255,255,255) title.TextScaled = true title.Font = Enum.Font.GothamBold title.Parent = topBar ------------------------------------------------ -- CLOSE BUTTON (X) ------------------------------------------------ local closeBtn = Instance.new("TextButton") closeBtn.Size = UDim2.new(0,40,0,40) closeBtn.Position = UDim2.new(1,-40,0,0) closeBtn.BackgroundColor3 = Color3.fromRGB(20,0,0) closeBtn.Text = "X" closeBtn.TextColor3 = Color3.fromRGB(255,255,255) closeBtn.TextScaled = true closeBtn.Parent = topBar Instance.new("UICorner", closeBtn).CornerRadius = UDim.new(0,6) ------------------------------------------------ -- MINIMIZE BUTTON (-) ------------------------------------------------ local miniBtn = Instance.new("TextButton") miniBtn.Size = UDim2.new(0,40,0,40) miniBtn.Position = UDim2.new(1,-80,0,0) miniBtn.BackgroundColor3 = Color3.fromRGB(20,20,20) miniBtn.Text = "-" miniBtn.TextColor3 = Color3.fromRGB(255,255,255) miniBtn.TextScaled = true miniBtn.Parent = topBar Instance.new("UICorner", miniBtn).CornerRadius = UDim.new(0,6) ------------------------------------------------ -- STATES ------------------------------------------------ local opened = false local minimized = false ------------------------------------------------ -- DRAG FUNCTION ------------------------------------------------ local function makeDraggable(frame) local dragging = false local dragStart local startPos frame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = frame.Position end end) frame.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) UserInputService.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart frame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) end makeDraggable(openBtn) makeDraggable(hub) ------------------------------------------------ -- OPEN / CLOSE / MINIMIZE LOGIC ------------------------------------------------ openBtn.MouseButton1Click:Connect(function() opened = true hub.Visible = true hub.Size = UDim2.new(0,0,0,0) TweenService:Create(hub, TweenInfo.new(0.25), { Size = UDim2.new(0,450,0,300) }):Play() end) closeBtn.MouseButton1Click:Connect(function() gui:Destroy() end) miniBtn.MouseButton1Click:Connect(function() minimized = not minimized if minimized then TweenService:Create(hub, TweenInfo.new(0.2), { Size = UDim2.new(0,450,0,40) }):Play() else TweenService:Create(hub, TweenInfo.new(0.2), { Size = UDim2.new(0,450,0,300) }):Play() end end)