local CoreGui = game:GetService("CoreGui") local UserInputService = game:GetService("UserInputService") local function IsMouseOverFrame(Frame, Position) local p, s = Frame.AbsolutePosition, Frame.AbsoluteSize return Position.X >= p.X and Position.X <= p.X + s.X and Position.Y >= p.Y and Position.Y <= p.Y + s.Y end local function MakeDraggable(MainFrame, DragFrame) local dragging, dragStart, startPos, currentTouch DragFrame.InputBegan:Connect(function(input) if input.UserInputState ~= Enum.UserInputState.Begin then return end if input.UserInputType ~= Enum.UserInputType.MouseButton1 and input.UserInputType ~= Enum.UserInputType.Touch then return end if not IsMouseOverFrame(DragFrame, input.Position) then return end dragging = true dragStart = input.Position startPos = MainFrame.Position currentTouch = input.UserInputType == Enum.UserInputType.Touch and input or nil end) UserInputService.InputChanged:Connect(function(input) if not dragging then return end if input.UserInputType ~= Enum.UserInputType.MouseMovement and input ~= currentTouch then return end local delta = input.Position - dragStart MainFrame.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end) UserInputService.InputEnded:Connect(function(input) if not dragging then return end if input.UserInputType == Enum.UserInputType.MouseButton1 or (input.UserInputType == Enum.UserInputType.Touch and input == currentTouch) then dragging, dragStart, startPos, currentTouch = nil, nil, nil, nil end end) end local parent = (gethui and gethui()) or CoreGui local old = parent:FindFirstChild("DummyUI") if old then old:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "DummyUI" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.Parent = parent local MainFrame = Instance.new("Frame") MainFrame.Size = UDim2.new(0, 180, 0, 110) MainFrame.Position = UDim2.new(0.5, -90, 0.5, -55) MainFrame.BackgroundTransparency = 1 MainFrame.BorderSizePixel = 0 MainFrame.Active = true MainFrame.Parent = gui local Header = Instance.new("Frame") Header.Size = UDim2.new(1, 0, 0, 20) Header.BackgroundColor3 = Color3.fromRGB(50, 50, 50) Header.BackgroundTransparency = 0.5 Header.BorderSizePixel = 0 Header.Parent = MainFrame local HeaderHitbox = Instance.new("TextButton") HeaderHitbox.Size = UDim2.new(1, 0, 1, 0) HeaderHitbox.BackgroundTransparency = 1 HeaderHitbox.Text = "" HeaderHitbox.AutoButtonColor = false HeaderHitbox.Parent = Header local Content = Instance.new("Frame") Content.Size = UDim2.new(1, 0, 1, -20) Content.Position = UDim2.new(0, 0, 0, 20) Content.BackgroundColor3 = Color3.fromRGB(20, 20, 20) Content.BackgroundTransparency = 0.5 Content.BorderSizePixel = 0 Content.Parent = MainFrame MakeDraggable(MainFrame, HeaderHitbox)