-- Variables and Services local player = game.Players.LocalPlayer local players = game:GetService("Players") local runService = game:GetService("RunService") local coreGui = game:GetService("CoreGui") -- Check if GUI already exists if coreGui:FindFirstChild("CustomGUI") then coreGui:FindFirstChild("CustomGUI"):Destroy() end -- GUI Setup local gui = Instance.new("ScreenGui") gui.Name = "CustomGUI" gui.Parent = coreGui -- Parent to CoreGui for persistence -- Function to create a button local function createButton(name, text, position, color) local button = Instance.new("TextButton") button.Name = name button.Size = UDim2.new(0, 120, 0, 30) button.Position = UDim2.new(unpack(position)) button.Text = text button.Parent = gui button.BackgroundColor3 = color button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.SourceSansBold button.TextSize = 16 return button end -- Function to create a text box local function createTextBox(name, placeholderText, position) local textBox = Instance.new("TextBox") textBox.Name = name textBox.Size = UDim2.new(0, 200, 0, 30) textBox.Position = UDim2.new(unpack(position)) textBox.PlaceholderText = placeholderText textBox.Text = "" textBox.Parent = gui textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255) textBox.TextColor3 = Color3.fromRGB(0, 0, 0) textBox.Font = Enum.Font.SourceSansBold textBox.TextSize = 16 return textBox end -- UI Elements local loopkillButton = createButton("LoopkillButton", "Start Loopkill", {0.9, -60, 0.3, -15}, Color3.fromRGB(255, 0, 0)) local targetBox = createTextBox("TargetBox", "Enter player name or 'all'", {0.9, -260, 0.3, -15}) -- Loopkill Logic local loopkillEnabled = false -- Function to teleport behind a target and point the sword towards the torso local function teleportBehindTarget(target) if target and target.Character and target.Character:FindFirstChild("HumanoidRootPart") and target.Character:FindFirstChild("Humanoid") then local rootPart = target.Character.HumanoidRootPart local torso = target.Character:FindFirstChild("UpperTorso") or target.Character:FindFirstChild("Torso") if torso then local lookVector = rootPart.CFrame.LookVector local offset = -lookVector * 3 -- Adjust distance behind the target (3 studs) local targetPosition = rootPart.Position + offset -- Teleport the player to the calculated position player.Character.HumanoidRootPart.CFrame = CFrame.new(targetPosition, torso.Position) -- Pointing towards the torso end end end -- Function to find players by partial name or display name local function findPlayersByPartialName(partialName) local matches = {} for _, plr in ipairs(players:GetPlayers()) do if plr ~= player and plr.Character and plr.Character:FindFirstChild("Humanoid") and plr.Character.Humanoid.Health > 0 then local name = plr.Name:lower() local displayName = plr.DisplayName:lower() if name:find(partialName) or displayName:find(partialName) then table.insert(matches, plr) end end end return matches end -- Function to get the next valid target from a list of matches local function getNextValidTarget(matches) for _, target in ipairs(matches) do if target.Character and target.Character:FindFirstChild("Humanoid") and target.Character.Humanoid.Health > 0 then return target end end return nil end -- Main Loopkill toggler function local function toggleLoopkill() local targetName = targetBox.Text:lower() loopkillEnabled = not loopkillEnabled if loopkillEnabled then loopkillButton.Text = "Stop Loopkill" loopkillButton.BackgroundColor3 = Color3.fromRGB(139, 0, 0) -- Dark Red spawn(function() local alreadyKilled = {} -- To keep track of players already killed while loopkillEnabled do if targetName == "all" then -- Get all valid targets local matches = findPlayersByPartialName("") if #matches == 0 then print("No valid targets remaining.") break end local target = getNextValidTarget(matches) if target then while loopkillEnabled and target.Character and target.Character:FindFirstChild("Humanoid") and target.Character.Humanoid.Health > 0 do teleportBehindTarget(target) runService.Heartbeat:Wait() end if target.Character and target.Character:FindFirstChild("Humanoid") and target.Character.Humanoid.Health == 0 then print("Target '" .. target.Name .. "' has been eliminated.") alreadyKilled[target] = true -- Mark this target as killed end end else -- Target specific player(s) by partial name local matches = findPlayersByPartialName(targetName) local target = getNextValidTarget(matches) if target then while loopkillEnabled and target.Character and target.Character:FindFirstChild("Humanoid") and target.Character.Humanoid.Health > 0 do teleportBehindTarget(target) runService.Heartbeat:Wait() end else print("No valid targets matching '" .. targetName .. "'.") loopkillEnabled = false end end end -- Reset the button state when finished loopkillButton.Text = "Start Loopkill" loopkillButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Bright Red end) else -- If stop is clicked, immediately reset loopkillEnabled and exit any ongoing loops loopkillEnabled = false loopkillButton.Text = "Start Loopkill" loopkillButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Bright Red end end -- Connect GUI events loopkillButton.MouseButton1Click:Connect(toggleLoopkill) -- ============================================================ -- === HITBOXES + CLICK-TO-SELECT (ADDED SAFELY, NO CHANGES) === -- ============================================================ local UIS = game:GetService("UserInputService") local camera = workspace.CurrentCamera -- Create highlights on every player except you local function applyHighlight(plr) if plr == player then return end if not plr.Character then return end if plr.Character:FindFirstChild("HighlightBox") then return end local hl = Instance.new("Highlight") hl.Name = "HighlightBox" hl.FillTransparency = 1 hl.OutlineTransparency = 0 hl.OutlineColor = Color3.fromRGB(255, 0, 0) hl.Parent = plr.Character end -- Apply highlights to existing players for _, plr in ipairs(players:GetPlayers()) do if plr.Character then applyHighlight(plr) end plr.CharacterAdded:Connect(function() task.wait(0.1) applyHighlight(plr) end) end -- Detect clicks on hitboxes UIS.InputEnded:Connect(function(input) if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end local mousePos = UIS:GetMouseLocation() local ray = camera:ViewportPointToRay(mousePos.X, mousePos.Y) local result = workspace:Raycast(ray.Origin, ray.Direction * 500, RaycastParams.new()) if result and result.Instance then local char = result.Instance:FindFirstAncestorOfClass("Model") if char then local plr = players:GetPlayerFromCharacter(char) if plr and plr ~= player then targetBox.Text = plr.Name print("Selected player:", plr.Name) end end end end)