local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local VirtualInputManager = game:GetService("VirtualInputManager") local Camera = workspace.CurrentCamera local LocalPlayer = Players.LocalPlayer local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "AutoPunchGui" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") local MainFrame = Instance.new("Frame") MainFrame.Size = UDim2.new(0, 200, 0, 180) MainFrame.Position = UDim2.new(0.1, 0, 0.1, 0) MainFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35) MainFrame.BorderSizePixel = 0 MainFrame.Parent = ScreenGui local UICorner = Instance.new("UICorner") UICorner.CornerRadius = UDim.new(0, 8) UICorner.Parent = MainFrame local Title = Instance.new("TextLabel") Title.Size = UDim2.new(1, -30, 0, 30) Title.Position = UDim2.new(0, 10, 0, 0) Title.BackgroundTransparency = 1 Title.Text = "Auto Punch Panel" Title.TextColor3 = Color3.fromRGB(255, 255, 255) Title.TextSize = 14 Title.Font = Enum.Font.GothamBold Title.TextXAlignment = Enum.TextXAlignment.Left Title.Parent = MainFrame local CloseBtn = Instance.new("TextButton") CloseBtn.Size = UDim2.new(0, 30, 0, 30) CloseBtn.Position = UDim2.new(1, -30, 0, 0) CloseBtn.BackgroundTransparency = 1 CloseBtn.Text = "X" CloseBtn.TextColor3 = Color3.fromRGB(200, 50, 50) CloseBtn.TextSize = 16 CloseBtn.Font = Enum.Font.GothamBold CloseBtn.Parent = MainFrame CloseBtn.MouseButton1Click:Connect(function() ScreenGui:Destroy() end) local dragging, dragStart, startPos MainFrame.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = MainFrame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) 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 MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) end end) local function createButton(name, position, defaultText) local btn = Instance.new("TextButton") btn.Size = UDim2.new(0, 180, 0, 35) btn.Position = position btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50) btn.TextColor3 = Color3.fromRGB(255, 255, 255) btn.TextSize = 13 btn.Font = Enum.Font.Gotham btn.Text = defaultText btn.Parent = MainFrame local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 6) corner.Parent = btn return btn end local AutoPunchBtn = createButton("AutoPunch", UDim2.new(0, 10, 0, 45), "Auto-Punch: OFF") local ShowHitboxBtn = createButton("ShowHitbox", UDim2.new(0, 10, 0, 90), "Show Hitboxes: OFF") local LockStatusLabel = Instance.new("TextLabel") LockStatusLabel.Size = UDim2.new(0, 180, 0, 25) LockStatusLabel.Position = UDim2.new(0, 10, 0, 135) LockStatusLabel.BackgroundTransparency = 1 LockStatusLabel.Text = "F to lock on: OFF" LockStatusLabel.TextColor3 = Color3.fromRGB(180, 180, 180) LockStatusLabel.TextSize = 12 LockStatusLabel.Font = Enum.Font.Gotham LockStatusLabel.Parent = MainFrame local autoPunchEnabled = false local showHitboxEnabled = false local lockedTarget = nil local lastPunchTime = 0 local punchCooldown = 0.35 AutoPunchBtn.MouseButton1Click:Connect(function() autoPunchEnabled = not autoPunchEnabled AutoPunchBtn.Text = "Auto-Punch: " .. (autoPunchEnabled and "ON" or "OFF") AutoPunchBtn.BackgroundColor3 = autoPunchEnabled and Color3.fromRGB(0, 170, 0) or Color3.fromRGB(50, 50, 50) end) ShowHitboxBtn.MouseButton1Click:Connect(function() showHitboxEnabled = not showHitboxEnabled ShowHitboxBtn.Text = "Show Hitboxes: " .. (showHitboxEnabled and "ON" or "OFF") ShowHitboxBtn.BackgroundColor3 = showHitboxEnabled and Color3.fromRGB(0, 170, 0) or Color3.fromRGB(50, 50, 50) if not showHitboxEnabled then for _, player in ipairs(Players:GetPlayers()) do if player.Character then for _, part in ipairs(player.Character:GetDescendants()) do if part.Name == "HitboxVisualizer" then part:Destroy() end end end end end end) local function getPlayerNearCursor() local mousePos = UserInputService:GetMouseLocation() local closestPlayer = nil local shortestDistance = 120 for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local root = player.Character:FindFirstChild("HumanoidRootPart") local humanoid = player.Character:FindFirstChildOfClass("Humanoid") if root and humanoid and humanoid.Health > 0 then local screenPos, onScreen = Camera:WorldToViewportPoint(root.Position) if onScreen then local screenVector = Vector2.new(screenPos.X, screenPos.Y) local distance = (screenVector - mousePos).Magnitude if distance < shortestDistance then shortestDistance = distance closestPlayer = player end end end end end return closestPlayer end UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.F then if lockedTarget then lockedTarget = nil LockStatusLabel.Text = "F to lock on: OFF" LockStatusLabel.TextColor3 = Color3.fromRGB(180, 180, 180) else local targetNearCursor = getPlayerNearCursor() if targetNearCursor then lockedTarget = targetNearCursor LockStatusLabel.Text = "F to lock on: " .. lockedTarget.Name LockStatusLabel.TextColor3 = Color3.fromRGB(0, 255, 0) end end elseif input.KeyCode == Enum.KeyCode.P then MainFrame.Visible = not MainFrame.Visible end end) RunService.RenderStepped:Connect(function() if not ScreenGui.Parent then return end local myChar = LocalPlayer.Character local myRoot = myChar and myChar:FindFirstChild("HumanoidRootPart") if lockedTarget then local char = lockedTarget.Character local humanoid = char and char:FindFirstChildOfClass("Humanoid") local root = char and char:FindFirstChild("HumanoidRootPart") if not char or not humanoid or humanoid.Health <= 0 or not root then lockedTarget = nil LockStatusLabel.Text = "F to lock on: OFF" LockStatusLabel.TextColor3 = Color3.fromRGB(180, 180, 180) else Camera.CFrame = CFrame.new(Camera.CFrame.Position, root.Position) end end for _, player in ipairs(Players:GetPlayers()) do if player ~= LocalPlayer and player.Character then local char = player.Character local highlight = char:FindFirstChild("HitboxVisualizerHighlight") if showHitboxEnabled then if not highlight then highlight = Instance.new("Highlight") highlight.Name = "HitboxVisualizerHighlight" highlight.Adornee = char highlight.FillColor = Color3.fromRGB(255, 0, 0) highlight.FillTransparency = 0.5 highlight.OutlineColor = Color3.fromRGB(255, 255, 255) highlight.OutlineTransparency = 0 highlight.Parent = char end highlight.Enabled = true else if highlight then highlight.Enabled = false end end end end if autoPunchEnabled and lockedTarget and myRoot then local char = lockedTarget.Character local humanoid = char and char:FindFirstChildOfClass("Humanoid") local root = char and char:FindFirstChild("HumanoidRootPart") if char and humanoid and humanoid.Health > 0 and root then if tick() - lastPunchTime >= punchCooldown then local distance = (myRoot.Position - root.Position).Magnitude local enemyVelocity = root.AssemblyLinearVelocity local futureMyPos = myRoot.Position + (myRoot.AssemblyLinearVelocity * 0.08) local futureEnemyPos = root.Position + (enemyVelocity * 0.08) local predictiveDistance = (futureMyPos - futureEnemyPos).Magnitude if distance <= 11 or predictiveDistance <= 10 then lastPunchTime = tick() VirtualInputManager:SendMouseButtonEvent(0, 0, 0, true, game, 0) task.wait(0.03) VirtualInputManager:SendMouseButtonEvent(0, 0, 0, false, game, 0) end end end end end)