-- ========================================= --
--             SERVICES & VARIABLES          --
-- ========================================= --
local ProximityPromptService = game:GetService("ProximityPromptService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local localPlayer = Players.LocalPlayer
local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()

-- // REMOTES
local MedKitRemote = ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("Miscs"):WaitForChild("MedKitRemote")
local GrowNeedleRemote = ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("Miscs"):WaitForChild("GrowNeedleSend")
local DogBiteRemote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("Dog"):WaitForChild("DogBite")
--local BadEyesRemote = ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("Miscs"):WaitForChild("BadEyesSend")

-- // TOGGLE VARIABLES
local AutoHealSelf = false
local AutoHealNear = false
local NeedleAll = false
local AntiStunned = false
local AntiMuzzle = false
local AutoAttack = false
local AutoAttackRange = 30
local AntiSit = false
local EspEnabled = false
local LoopKill = false
local loopKillTarget = nil
local loopKillConnection = nil

local GuardLoopKill = false
local guardLoopKillTarget = nil
local guardLoopKillConnection = nil

local safePart = Instance.new("Part")
safePart.Size = Vector3.new(100, 1, 100)
safePart.Anchored = true
safePart.CanCollide = true
safePart.Transparency = 0.5
safePart.Position = Vector3.new(0, 500, 0)
safePart.Parent = workspace

-- // MISC VARIABLES
local needleCooldowns = {}
local selectedLeashTarget = nil
local savedHoldDurations = {}
local instantPromptsEnabled = false
local promptAddedConnection = nil
local IsDoorsRemoved = false
local highlights = {}
local TeamColors = {
	["Dogs"] = Color3.fromRGB(255, 170, 0),
	["Guards"] = Color3.fromRGB(0, 85, 255),
	["StrayDogs"] = Color3.fromRGB(255, 0, 0),
}


-- ========================================= --
--                FUNCTIONS                  --
-- ========================================= --

local function ClickBaton()
	local baton = localPlayer.Character and localPlayer.Character:FindFirstChild("Baton")
	if baton and baton:FindFirstChild("Handle") then
		local args = {baton.Handle}
		baton.Activated:Fire()
		-- fallback
		pcall(function() mouse1click() end)
	end
end

local function GetDogOptions()
	local options = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and
			(player.Team.Name == "Dogs" or player.Team.Name == "StrayDogs") then
			table.insert(options, player.Name)
		end
	end
	if #options == 0 then
		table.insert(options, "No dogs found")
	end
	return options
end

local function StartGuardLoopKill()
    Rayfield:Notify({ Title = "WARNING!!", Content = "This may not work correctly, so don't use it, I will try to fix it", Duration = 3.5, Image = nil })
	if not guardLoopKillTarget or not guardLoopKillTarget.Parent then
		Rayfield:Notify({ Title = "Notification", Content = "No target selected.", Duration = 2.5, Image = nil })
		GuardLoopKill = false
		return
	end

	local char = localPlayer.Character
	if not char or not char:FindFirstChild("HumanoidRootPart") then return end

	local savedPosition = char.HumanoidRootPart.CFrame

	local camera = workspace.CurrentCamera
	local originalCameraType = camera.CameraType
	local originalCameraSubject = camera.CameraSubject

	camera.CameraType = Enum.CameraType.Custom
	local targetChar = guardLoopKillTarget.Character
	local targetHRP = targetChar and targetChar:FindFirstChild("HumanoidRootPart")
	if targetHRP then
		camera.CameraSubject = targetHRP
	end

	local cameraConnection = RunService.RenderStepped:Connect(function()
		if not GuardLoopKill or not guardLoopKillTarget or not guardLoopKillTarget.Parent then return end
		local tChar = guardLoopKillTarget.Character
		local tHRP = tChar and tChar:FindFirstChild("HumanoidRootPart")
		if tHRP and camera.CameraSubject ~= tHRP then
			camera.CameraSubject = tHRP
		end
	end)

	guardLoopKillConnection = Players.PlayerRemoving:Connect(function(player)
		if player == guardLoopKillTarget then
			GuardLoopKill = false
			guardLoopKillTarget = nil
			if guardLoopKillConnection then
				guardLoopKillConnection:Disconnect()
				guardLoopKillConnection = nil
			end
			Rayfield:Notify({ Title = "Notification", Content = player.Name .. " left the game.", Duration = 3, Image = nil })
		end
	end)

	task.spawn(function()
		while GuardLoopKill do
			if not guardLoopKillTarget or not guardLoopKillTarget.Parent then break end

			local currentChar = localPlayer.Character
			if not currentChar or not currentChar:FindFirstChild("HumanoidRootPart") then
				task.wait(0.5)
				continue
			end

			-- Forzar equip del Baton
			local baton = localPlayer.Backpack:FindFirstChild("Baton")
				or currentChar:FindFirstChild("Baton")
			if baton then
				local humanoid = currentChar:FindFirstChildOfClass("Humanoid")
				if humanoid then humanoid:EquipTool(baton) end
			end

			local tChar = guardLoopKillTarget.Character
			local tHRP = tChar and tChar:FindFirstChild("HumanoidRootPart")

			if tHRP then
				currentChar.HumanoidRootPart.CFrame = tHRP.CFrame * CFrame.new(-1, -1, 0)

				-- Simular click del Baton
				local equippedBaton = currentChar:FindFirstChild("Baton")
				if equippedBaton then
					pcall(function()
						local VIM = game:GetService("VirtualInputManager")
						VIM:SendMouseButtonEvent(0, 0, 0, true, game, 1)
						task.wait(0.01)
						VIM:SendMouseButtonEvent(0, 0, 0, false, game, 1)
					end)
					-- fallback
					pcall(function() mouse1click() end)
				end

				task.wait(1)
				currentChar.HumanoidRootPart.CFrame = CFrame.new(safePart.Position + Vector3.new(0, 15, 0))
			end

			task.wait(1.9)
		end

		cameraConnection:Disconnect()
		camera.CameraType = originalCameraType
		camera.CameraSubject = originalCameraSubject

		local currentChar = localPlayer.Character
		if currentChar and currentChar:FindFirstChild("HumanoidRootPart") then
			currentChar.HumanoidRootPart.CFrame = savedPosition
		end

		if guardLoopKillConnection then
			guardLoopKillConnection:Disconnect()
			guardLoopKillConnection = nil
		end
	end)
end

local function GetArrestedDogs()
	local options = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and
			(player.Team.Name == "Dogs" or player.Team.Name == "StrayDogs") then
			local character = player.Character
			if character then
				for _, obj in ipairs(character:GetDescendants()) do
					if obj:IsA("Accessory") and obj.Name == "Muzzle" then
						table.insert(options, player.Name)
						break
					end
				end
			end
		end
	end
	if #options == 0 then
		table.insert(options, "No arrested dogs")
	end
	return options
end


local function GetNonArrestedDogs()
	local options = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and
			(player.Team.Name == "Dogs" or player.Team.Name == "StrayDogs") then
			local character = player.Character
			local hasMuzzle = false
			if character then
				for _, obj in ipairs(character:GetDescendants()) do
					if obj:IsA("Accessory") and obj.Name == "Muzzle" then
						hasMuzzle = true
						break
					end
				end
			end
			if not hasMuzzle then
				table.insert(options, player.Name)
			end
		end
	end
	if #options == 0 then
		table.insert(options, "No dogs found")
	end
	return options
end

local function AutoCollectItems()
	local char = localPlayer.Character
	if not char or not char:FindFirstChild("HumanoidRootPart") then
		Rayfield:Notify({ Title = "Notification", Content = "Character not found.", Duration = 2.5, Image = nil })
		return
	end

	local root = char.HumanoidRootPart
	local currentpos = root.CFrame

	local function fireNearby(range)
		for _, v in pairs(game:GetDescendants()) do
			if v:IsA("ProximityPrompt") then
				local parent = v.Parent
				local pos = parent:IsA("BasePart") and parent.Position 
					or (parent:IsA("Model") and parent:GetPivot().Position)
				if pos and (root.Position - pos).Magnitude <= (range or 25) then
					pcall(function() fireproximityprompt(v) end)
				end
			end
		end
	end

	root.CFrame = CFrame.new(-61.264, 13.620, 158.479)
	local s1 = tick()
	while tick() - s1 < 2 do
		fireNearby(25)
		task.wait(0.1)
	end

	root.CFrame = CFrame.new(-57.490, 13.538, 124.575)
	local s2 = tick()
	while tick() - s2 < 2 do
		fireNearby(25)
		task.wait(0.1)
	end

	root.CFrame = currentpos

	Rayfield:Notify({ Title = "Notification", Content = "Items collected.", Duration = 2.5, Image = nil })
end

local function GetGuardOptions()
	local options = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and player.Team.Name == "Guards" then
			table.insert(options, player.Name)
		end
	end
	if #options == 0 then
		table.insert(options, "No guards found")
	end
	return options
end

local function StartLoopKill()
	if not loopKillTarget or not loopKillTarget.Parent then
		Rayfield:Notify({ Title = "Notification", Content = "No target selected.", Duration = 2.5, Image = nil })
		LoopKill = false
		return
	end

	local char = localPlayer.Character
	if not char or not char:FindFirstChild("HumanoidRootPart") then return end

	-- Guardar posicion original antes de empezar
	local savedPosition = char.HumanoidRootPart.CFrame

	-- Configurar camara para espectear al objetivo
	local camera = workspace.CurrentCamera
	local originalCameraType = camera.CameraType
	local originalCameraSubject = camera.CameraSubject

	camera.CameraType = Enum.CameraType.Custom

	-- Apuntar al HRP del objetivo como subject
	local targetChar = loopKillTarget.Character
	local targetHRP = targetChar and targetChar:FindFirstChild("HumanoidRootPart")
	if targetHRP then
		camera.CameraSubject = targetHRP
	end

	-- Actualizar subject si el objetivo respawnea
	local cameraConnection = RunService.RenderStepped:Connect(function()
		if not LoopKill or not loopKillTarget or not loopKillTarget.Parent then return end
		local tChar = loopKillTarget.Character
		local tHRP = tChar and tChar:FindFirstChild("HumanoidRootPart")
		if tHRP and camera.CameraSubject ~= tHRP then
			camera.CameraSubject = tHRP
		end
	end)

	-- Detectar si el objetivo se va del juego
	loopKillConnection = Players.PlayerRemoving:Connect(function(player)
		if player == loopKillTarget then
			LoopKill = false
			loopKillTarget = nil
			if loopKillConnection then
				loopKillConnection:Disconnect()
				loopKillConnection = nil
			end
			Rayfield:Notify({ Title = "Notification", Content = player.Name .. " left the game.", Duration = 3, Image = nil })
		end
	end)

	task.spawn(function()
		while LoopKill do
			if not loopKillTarget or not loopKillTarget.Parent then break end

			local currentChar = localPlayer.Character
			if not currentChar or not currentChar:FindFirstChild("HumanoidRootPart") then
				task.wait(0.5)
				continue
			end

			local targetChar = loopKillTarget.Character
			local targetHRP = targetChar and targetChar:FindFirstChild("HumanoidRootPart")

			if targetHRP then
				currentChar.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
				pcall(function() DogBiteRemote:FireServer() end)
				task.wait()
				currentChar.HumanoidRootPart.CFrame = CFrame.new(safePart.Position + Vector3.new(0, 10, 0))
			end

			task.wait(2)
		end


		cameraConnection:Disconnect()
		camera.CameraType = originalCameraType
		camera.CameraSubject = originalCameraSubject

		-- Regresar a posicion original
		local currentChar = localPlayer.Character
		if currentChar and currentChar:FindFirstChild("HumanoidRootPart") then
			currentChar.HumanoidRootPart.CFrame = savedPosition
		end

		-- Limpiar conexion
		if loopKillConnection then
			loopKillConnection:Disconnect()
			loopKillConnection = nil
		end
	end)
end

local function MapTp(Target)
	local sites = {
		["dog pound"] = Vector3.new(-4, 15, 47),
		["Outside the dog pound"] = Vector3.new(-183, 13, -102),
		["Above the dog pound"] = Vector3.new(-18, 39, -57),
		["StrayDogs Base"] = Vector3.new(-952, 38, -759),
	}

	if sites[Target] then
		local character = localPlayer.Character
		if not character then return end

		local rootPart = character:FindFirstChild("HumanoidRootPart")
		if rootPart then
			rootPart.CFrame = CFrame.new(sites[Target])
		end
	else
		Rayfield:Notify({ Title = "Notification", Content = "Location not found: " .. tostring(Target), Duration = 2.5, Image = nil })
	end
end

local function ToggleInstantPrompts(enabled)
	instantPromptsEnabled = enabled
	if enabled then
		savedHoldDurations = {}
		for _, obj in pairs(game:GetDescendants()) do
			if obj:IsA("ProximityPrompt") then
				savedHoldDurations[obj] = obj.HoldDuration
				obj.HoldDuration = 0
			end
		end

		promptAddedConnection = game.DescendantAdded:Connect(function(obj)
			if instantPromptsEnabled and obj:IsA("ProximityPrompt") then
				task.wait() 
				savedHoldDurations[obj] = obj.HoldDuration
				obj.HoldDuration = 0
			end
		end)
		Rayfield:Notify({ Title = "Notification", Content = "Instant Prompts Enabled.", Duration = 2.5, Image = nil })
	else
		if promptAddedConnection then
			promptAddedConnection:Disconnect()
			promptAddedConnection = nil
		end
		for prompt, duration in pairs(savedHoldDurations) do
			if prompt and prompt.Parent then
				prompt.HoldDuration = duration
			end
		end
		savedHoldDurations = {}
		Rayfield:Notify({ Title = "Notification", Content = "Instant Prompts Disabled.", Duration = 2.5, Image = nil })
	end
end

local istpremoved = false

local function RemoveVetTPS()
	if istpremoved then
		Rayfield:Notify({ Title = "Notification", Content = "Vet Teleports already removed.", Duration = 2.5, Image = nil })
		return
	end
	istpremoved = true

	local tpss = {
		"NonVetKick",
		"NonVetKickDog"
	}

	for _, tps in ipairs(tpss) do
		for _, tepe in ipairs(workspace:GetDescendants()) do
			if tepe:IsA("Part") and tepe.Name == tps then
				tepe:Destroy()
			end
		end
	end
end



local function RemoveDoors()
	if IsDoorsRemoved then
		Rayfield:Notify({ Title = "Notification", Content = "Doors already removed.", Duration = 2.5, Image = nil })
		return
	end
	IsDoorsRemoved = true

	local doorsTypes = {
		"AmouredDoor", "BarDoor", "BigBarDoor", "CageDoor", 
		"YardBarDoor", "DoctorsDoor", "GuardDoor", "LockedDoor", 
		"MainDoor", "DoctorsDoubleDoor",
	}

	for _, doorType in ipairs(doorsTypes) do
		for _, door in ipairs(workspace:GetDescendants()) do
			if door:IsA("Model") and door.Name == doorType then
				door:Destroy()
			end
		end
	end
end

local function GetPlayerTeam(player)
	if player.Team then return player.Team.Name end
	return nil
end

local function AddHighlight(player)
	if player == localPlayer then return end
	local character = player.Character
	if not character then return end

	if highlights[player] then
		highlights[player]:Destroy()
		highlights[player] = nil
	end

	local teamName = GetPlayerTeam(player)
	local color = TeamColors[teamName] or Color3.fromRGB(255, 255, 255)

	local highlight = Instance.new("Highlight")
	highlight.FillColor = color
	highlight.OutlineColor = color
	highlight.FillTransparency = 0.5
	highlight.OutlineTransparency = 0
	highlight.Adornee = character
	highlight.Parent = character

	highlights[player] = highlight
end

local function RemoveHighlight(player)
	if highlights[player] then
		highlights[player]:Destroy()
		highlights[player] = nil
	end
end

local function RemoveAllHighlights()
	for player, _ in pairs(highlights) do
		RemoveHighlight(player)
	end
end

local function SetupPlayer(player)
	if player == localPlayer then return end

	player.CharacterAdded:Connect(function()
		if EspEnabled then
			task.wait(0.5) 
			AddHighlight(player)
		end
	end)

	player:GetPropertyChangedSignal("Team"):Connect(function()
		if EspEnabled then
			task.wait()
			AddHighlight(player)
		end
	end)
end

local function EspTeams()
	EspEnabled = not EspEnabled

	if EspEnabled then
		Rayfield:Notify({ Title = "Notification", Content = "Esp Enabled", Duration = 2.5, Image = nil })
		for _, player in ipairs(Players:GetPlayers()) do
			SetupPlayer(player)
			AddHighlight(player)
		end
		Players.PlayerAdded:Connect(function(player)
			if not EspEnabled then return end
			SetupPlayer(player)
		end)
		Players.PlayerRemoving:Connect(function(player)
			RemoveHighlight(player)
		end)
	else
		Rayfield:Notify({ Title = "Notification", Content = "Esp Disabled", Duration = 2.5, Image = nil })
		RemoveAllHighlights()
	end
end

local function ArrestAll()
	local dogsAndStrays = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and
			(player.Team.Name == "Dogs" or player.Team.Name == "StrayDogs") then

			local character = player.Character
			local alreadyArrested = false
			if character then
				for _, obj in ipairs(character:GetDescendants()) do
					if obj:IsA("Accessory") and obj.Name == "Muzzle" then
						alreadyArrested = true
						break
					end
				end
			end

			if not alreadyArrested then
				table.insert(dogsAndStrays, player)
			end
		end
	end

	if #dogsAndStrays == 0 then
		Rayfield:Notify({ Title = "Notification", Content = "0 dogs found.", Duration = 2.5, Image = nil })
		return
	end

	if not localPlayer.Team or localPlayer.Team.Name ~= "Guards" then
		Rayfield:Notify({ Title = "Notification", Content = "You need to be a guard.", Duration = 2.5, Image = nil })
		return
	end

	local muzzle = localPlayer.Backpack:FindFirstChild("Muzzle")
		or localPlayer.Character:FindFirstChild("Muzzle")

	if not muzzle then
		Rayfield:Notify({ Title = "Notification", Content = "Muzzle not found in backpack.", Duration = 2.5, Image = nil })
		return
	end

	local humanoid = localPlayer.Character and localPlayer.Character:FindFirstChildOfClass("Humanoid")
	if humanoid then humanoid:EquipTool(muzzle) end
	task.wait(0.3)

	local originalCFrame = localPlayer.Character.HumanoidRootPart.CFrame

	for _, player in ipairs(dogsAndStrays) do
		if not player or not player.Parent then continue end
		local targetCharacter = player.Character
		if not targetCharacter then continue end
		local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart")
		if not targetHRP then continue end
		local targetHumanoid = targetCharacter:FindFirstChildOfClass("Humanoid")
		if not targetHumanoid or targetHumanoid.Health <= 0 then continue end

		local alreadyArrested = false
		for _, obj in ipairs(targetCharacter:GetDescendants()) do
			if obj:IsA("Accessory") and obj.Name == "Muzzle" then
				alreadyArrested = true
				break
			end
		end
		if alreadyArrested then continue end

		local prompt = nil
		for _, obj in ipairs(targetCharacter:GetDescendants()) do
			if obj:IsA("ProximityPrompt") and obj.Name == "MuzzleProximityPrompt" then
				prompt = obj
				break
			end
		end
		if not prompt then warn("No prompt found for: " .. player.Name) continue end

		prompt.HoldDuration = 0
		prompt.MaxActivationDistance = 50

		localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)

		local s = tick()
		while tick() - s < 0.3 do
			if not player.Parent or not targetCharacter.Parent then break end
			localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
			pcall(function() fireproximityprompt(prompt) end)
			task.wait(0.1)
		end

		task.wait(0.1)
	end

	localPlayer.Character.HumanoidRootPart.CFrame = originalCFrame
	Rayfield:Notify({ Title = "Notification", Content = "All dogs arrested.", Duration = 2.5, Image = nil })
end

local function BreakOutAll()
	if not localPlayer.Team or localPlayer.Team.Name == "Guards" then
		Rayfield:Notify({ Title = "Notification", Content = "You need to be a dog.", Duration = 2.5, Image = nil })
		return
	end

	local arrestedDogs = {}
	for _, player in ipairs(Players:GetPlayers()) do
		if player ~= localPlayer and player.Team and
			(player.Team.Name == "Dogs" or player.Team.Name == "StrayDogs") then
			local character = player.Character
			if character then
				local hasMuzzle = false
				for _, obj in ipairs(character:GetDescendants()) do
					if obj:IsA("Accessory") and obj.Name == "Muzzle" then
						hasMuzzle = true
						break
					end
				end
				if hasMuzzle then table.insert(arrestedDogs, player) end
			end
		end
	end

	if #arrestedDogs == 0 then
		Rayfield:Notify({ Title = "Notification", Content = "No arrested dogs found.", Duration = 2.5, Image = nil })
		return
	end

	local originalCFrame = localPlayer.Character.HumanoidRootPart.CFrame

	for _, player in ipairs(arrestedDogs) do
		if not player or not player.Parent then continue end
		local targetCharacter = player.Character
		if not targetCharacter then continue end
		local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart")
		if not targetHRP then continue end
		local targetHumanoid = targetCharacter:FindFirstChildOfClass("Humanoid")
		if not targetHumanoid or targetHumanoid.Health <= 0 then continue end

		local prompt = nil
		for _, obj in ipairs(targetCharacter:GetDescendants()) do
			if obj:IsA("ProximityPrompt") and obj.Name == "BreakOutProximityPrompt" then
				prompt = obj
				break
			end
		end
		if not prompt then warn("No BreakOutProximityPrompt found for: " .. player.Name) continue end

		prompt.HoldDuration = 0
		prompt.MaxActivationDistance = 50

		localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)

		local s = tick()
		while tick() - s < 0.3 do
			if not player.Parent or not targetCharacter.Parent then break end
			localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
			pcall(function() fireproximityprompt(prompt) end)
			task.wait(0.1)
		end

		task.wait(0.2)
	end

	localPlayer.Character.HumanoidRootPart.CFrame = originalCFrame
	Rayfield:Notify({ Title = "Notification", Content = "All dogs freed.", Duration = 2.5, Image = nil })
end


-- ========================================= --
--              BACKGROUND LOOPS             --
-- ========================================= --

-- Anti Sit
task.spawn(function()
	while true do
		if AntiSit and localPlayer.Character then
			local humanoid = localPlayer.Character:FindFirstChildOfClass("Humanoid")
			if humanoid and humanoid.Sit then
				humanoid.Sit = false
			end
		end
		task.wait(0.1)
	end
end)

-- Auto Attack
task.spawn(function()
	while true do
		if AutoAttack and localPlayer.Character and localPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local rootPart = localPlayer.Character.HumanoidRootPart
			local closestGuard = nil
			local closestDist = math.huge

			for _, p in pairs(Players:GetPlayers()) do
				if p ~= localPlayer and p.Team and p.Team.Name == "Guards" and p.Character then
					local targetHRP = p.Character:FindFirstChild("HumanoidRootPart")
					local targetHumanoid = p.Character:FindFirstChildOfClass("Humanoid")

					if targetHRP and targetHumanoid and targetHumanoid.Health > 0 then
						local dist = (rootPart.Position - targetHRP.Position).Magnitude
						if dist < closestDist then
							closestDist = dist
							closestGuard = p
						end
					end
				end
			end

			if closestGuard and closestDist <= AutoAttackRange then
				local targetHRP = closestGuard.Character:FindFirstChild("HumanoidRootPart")
				if targetHRP then
					rootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
					pcall(function() DogBiteRemote:FireServer() end)
				end
			end
		end
		task.wait(1)
	end
end)

-- Anti Muzzle
task.spawn(function()
	while true do
		if AntiMuzzle and localPlayer.Character and localPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local rootPart = localPlayer.Character.HumanoidRootPart
			local rootPos = rootPart.Position

			for _, p in pairs(Players:GetPlayers()) do
				if p ~= localPlayer and p.Character then
					local character = p.Character

					local hasMuzzleEquipped = false
					for _, obj in ipairs(character:GetChildren()) do
						if obj:IsA("Tool") and obj.Name == "Muzzle" then
							hasMuzzleEquipped = true
							break
						end
					end

					if hasMuzzleEquipped then
						local targetHRP = character:FindFirstChild("HumanoidRootPart")
						if targetHRP then
							local dist = (rootPos - targetHRP.Position).Magnitude
							if dist <= 15 then
								local savedCFrame = rootPart.CFrame
								rootPart.CFrame = savedCFrame * CFrame.new(0, 500, 0)
								task.wait()
								rootPart.CFrame = savedCFrame
							end
						end
					end
				end
			end
		end
		task.wait(0.1)
	end
end)

-- Anti Stunned
task.spawn(function()
	while true do
		if AntiStunned and localPlayer.Character then
			local humanoid = localPlayer.Character:FindFirstChildOfClass("Humanoid")
			if humanoid then
				if humanoid.WalkSpeed == 0 and humanoid.JumpPower == 0 then
					humanoid.WalkSpeed = 30
					humanoid.JumpPower = 50
				end
			end
		end
		task.wait(0.05)
	end
end)

-- Needle All
task.spawn(function()
	while true do
		if NeedleAll and localPlayer.Character and localPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local rootPos = localPlayer.Character.HumanoidRootPart.Position
			for _, p in pairs(Players:GetPlayers()) do
				if p ~= localPlayer and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
					local dist = (rootPos - p.Character.HumanoidRootPart.Position).Magnitude
					local lastFire = needleCooldowns[p] or 0

					if dist <= 20 and tick() - lastFire >= 0.4 then
						pcall(function() GrowNeedleRemote:FireServer(p.Character, "Fire") end)
						needleCooldowns[p] = tick()
					end
				end
			end
			task.wait(0.1)
		else
			task.wait(0.3)
		end
	end
end)

-- Auto Heal
task.spawn(function()
	while true do
		if AutoHealSelf and localPlayer.Character then
			pcall(function() MedKitRemote:FireServer(true, localPlayer.Character) end)
		end

		if AutoHealNear and localPlayer.Character and localPlayer.Character:FindFirstChild("HumanoidRootPart") then
			local rootPos = localPlayer.Character.HumanoidRootPart.Position
			for _, p in pairs(Players:GetPlayers()) do
				if p ~= localPlayer and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
					if (rootPos - p.Character.HumanoidRootPart.Position).Magnitude <= 20 then
						pcall(function() MedKitRemote:FireServer(true, p.Character) end)
					end
				end
			end
		end
		task.wait(0.3)
	end
end)


-- ========================================= --
--              USER INTERFACE               --
-- ========================================= --

local Window = Rayfield:CreateWindow({
	Name = "Dog Pound Exploit",
	Icon = 0,
	LoadingTitle = "Loading yo ass script",
	LoadingSubtitle = "by Zultx",
	ShowText = "Rayfield",
	Theme = "Default",
	ToggleUIKeybind = "M",
	DisableRayfieldPrompts = false,
	DisableBuildWarnings = false,
	ConfigurationSaving = {
		Enabled = false,
		FolderName = nil,
		FileName = "Nothing"
	},
	Discord = { Enabled = false, Invite = "noinvitelink", RememberJoins = true },
	KeySystem = false,
})

-- // TAB: GUARDS
local TabGuards = Window:CreateTab("Guards", "shield")

TabGuards:CreateSection("Arrest System")
TabGuards:CreateButton({
	Name = "Arrest Wanted Dogs",
	Callback = function() ArrestAll() end,
})

-- // SINGLE ARREST
TabGuards:CreateSection("Single Arrest")

local singleArrestTarget = nil

local SingleArrestDropdown = TabGuards:CreateDropdown({
	Name = "Select Dog to Arrest",
	Options = GetNonArrestedDogs(),
	CurrentOption = {"No dogs found"},
	MultipleOptions = false,
	Flag = "SingleArrestDropdown",
	Callback = function(Options)
		local selected = type(Options) == "table" and Options[1] or Options
		if selected == "No dogs found" then
			singleArrestTarget = nil
			return
		end
		singleArrestTarget = Players:FindFirstChild(selected)
	end,
})

task.spawn(function()
	while true do
		task.wait(0.5)
		local newOptions = GetNonArrestedDogs()
		SingleArrestDropdown:Refresh(newOptions, true)
	end
end)

TabGuards:CreateButton({
	Name = "Arrest Selected Dog",
	Callback = function()
		if not singleArrestTarget or not singleArrestTarget.Parent then
			Rayfield:Notify({ Title = "Notification", Content = "No player selected.", Duration = 2.5, Image = nil })
			return
		end

		if not localPlayer.Team or localPlayer.Team.Name ~= "Guards" then
			Rayfield:Notify({ Title = "Notification", Content = "You need to be a guard.", Duration = 2.5, Image = nil })
			return
		end

		local targetCharacter = singleArrestTarget.Character
		if not targetCharacter then return end

		-- Verificar si ya tiene Muzzle (ya arrestado)
		for _, obj in ipairs(targetCharacter:GetDescendants()) do
			if obj:IsA("Accessory") and obj.Name == "Muzzle" then
				Rayfield:Notify({ Title = "Notification", Content = "The selected dog is not wanted.", Duration = 2.5, Image = nil })
				return
			end
		end

		local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart")
		if not targetHRP then return end
		local targetHumanoid = targetCharacter:FindFirstChildOfClass("Humanoid")
		if not targetHumanoid or targetHumanoid.Health <= 0 then return end

		local muzzle = localPlayer.Backpack:FindFirstChild("Muzzle")
			or localPlayer.Character:FindFirstChild("Muzzle")

		if not muzzle then
			Rayfield:Notify({ Title = "Notification", Content = "Muzzle not found in backpack.", Duration = 2.5, Image = nil })
			return
		end

		local humanoid = localPlayer.Character and localPlayer.Character:FindFirstChildOfClass("Humanoid")
		if humanoid then humanoid:EquipTool(muzzle) end
		task.wait(0.3)

		local prompt = nil
		for _, obj in ipairs(targetCharacter:GetDescendants()) do
			if obj:IsA("ProximityPrompt") and obj.Name == "MuzzleProximityPrompt" then
				prompt = obj
				break
			end
		end

		if not prompt then
			Rayfield:Notify({ Title = "Notification", Content = "The selected dog is not wanted.", Duration = 2.5, Image = nil })
			return
		end

		prompt.HoldDuration = 0
		prompt.MaxActivationDistance = 50

		local originalCFrame = localPlayer.Character.HumanoidRootPart.CFrame
		localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)

		local s = tick()
		while tick() - s < 0.4 do
			if not singleArrestTarget.Parent or not targetCharacter.Parent then break end
			localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
			pcall(function() fireproximityprompt(prompt) end)
			task.wait(0.1)
		end

		localPlayer.Character.HumanoidRootPart.CFrame = originalCFrame

		-- Verificar si se arrestó bien
		task.wait(0.3)
		local arrested = false
		if targetCharacter and targetCharacter.Parent then
			for _, obj in ipairs(targetCharacter:GetDescendants()) do
				if obj:IsA("Accessory") and obj.Name == "Muzzle" then
					arrested = true
					break
				end
			end
		end

		if arrested then
			Rayfield:Notify({ Title = "Notification", Content = singleArrestTarget.Name .. " has been arrested.", Duration = 2.5, Image = nil })
		else
			Rayfield:Notify({ Title = "Notification", Content = "The selected dog is not wanted.", Duration = 2.5, Image = nil })
		end
	end,
})

TabGuards:CreateSection("Guard Loop Kill")

local GuardLoopKillDropdown = TabGuards:CreateDropdown({
	Name = "Select Dog Target",
	Options = GetDogOptions(),
	CurrentOption = {"No dogs found"},
	MultipleOptions = false,
	Flag = "GuardLoopKillDropdown",
	Callback = function(Options)
		local selected = type(Options) == "table" and Options[1] or Options
		if selected == "No dogs found" then
			guardLoopKillTarget = nil
			return
		end
		guardLoopKillTarget = Players:FindFirstChild(selected)
	end,
})

task.spawn(function()
	while true do
		task.wait(0.5)
		local newOptions = GetDogOptions()
		GuardLoopKillDropdown:Refresh(newOptions, true)
	end
end)

TabGuards:CreateToggle({
	Name = "Guard Loop Kill",
	CurrentValue = false,
	Flag = "GuardLoopKill",
	Callback = function(Value)
		GuardLoopKill = Value
		if Value then
			StartGuardLoopKill()
		end
	end,
})

TabGuards:CreateSection("Leash System")
local LeashDropdown = TabGuards:CreateDropdown({
	Name = "Select Arrested Dog",
	Options = GetArrestedDogs(),
	CurrentOption = {"No arrested dogs"},
	MultipleOptions = false,
	Flag = "LeashDropdown",
	Callback = function(Options)
		local selected = type(Options) == "table" and Options[1] or Options
		if selected == "No arrested dogs" then
			selectedLeashTarget = nil
			return
		end
		selectedLeashTarget = Players:FindFirstChild(selected)
	end,
})

task.spawn(function()
	while true do
		task.wait(0.5)
		local newOptions = GetArrestedDogs()
		LeashDropdown:Refresh(newOptions, true)
	end
end)

TabGuards:CreateButton({
	Name = "Leash Selected Player",
	Callback = function()
		if not selectedLeashTarget then
			Rayfield:Notify({ Title = "Notification", Content = "No player selected.", Duration = 2.5, Image = nil })
			return
		end
		if not localPlayer.Team or localPlayer.Team.Name ~= "Guards" then
			Rayfield:Notify({ Title = "Notification", Content = "You need to be a guard.", Duration = 2.5, Image = nil })
			return
		end

		local targetCharacter = selectedLeashTarget.Character
		if not targetCharacter then return end
		local targetHRP = targetCharacter:FindFirstChild("HumanoidRootPart")
		if not targetHRP then return end

		local leash = localPlayer.Backpack:FindFirstChild("Leash") or localPlayer.Character:FindFirstChild("Leash")
		if not leash then
			Rayfield:Notify({ Title = "Notification", Content = "Leash not found in backpack.", Duration = 2.5, Image = nil })
			return
		end

		local humanoid = localPlayer.Character and localPlayer.Character:FindFirstChildOfClass("Humanoid")
		if humanoid then humanoid:EquipTool(leash) end
		task.wait(0.3)

		local prompt = targetHRP:FindFirstChild("LeashProximityPrompt")
		if not prompt then
			for _, obj in ipairs(targetCharacter:GetDescendants()) do
				if obj:IsA("ProximityPrompt") and obj.Name == "LeashProximityPrompt" then
					prompt = obj
					break
				end
			end
		end
		if not prompt then return end

		prompt.HoldDuration = 0
		prompt.MaxActivationDistance = 50

		localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
		local s = tick()
		while tick() - s < 0.5 do
			localPlayer.Character.HumanoidRootPart.CFrame = targetHRP.CFrame * CFrame.new(0, 0, -2)
			pcall(function() fireproximityprompt(prompt) end)
			task.wait(0.1)
		end

		Rayfield:Notify({ Title = "Notification", Content = "Leashed " .. selectedLeashTarget.Name, Duration = 2.5, Image = nil })
	end,
})

-- // TAB: DOGS
local TabDogs = Window:CreateTab("Dogs", "paw-print")

TabDogs:CreateSection("Role & Actions")
TabDogs:CreateButton({
	Name = "Become Stray",
	Callback = function()
		local character = localPlayer.Character
		local rootPart = character:FindFirstChild("HumanoidRootPart")
		local currentposition = rootPart.Position

		if localPlayer.Team == game.Teams.Guards then return end
		if localPlayer.Team == game.Teams.StrayDogs then return end

		local models = {}
		for _, model in pairs(game.Workspace:GetDescendants()) do
			if model:IsA("Model") and model.Name == "TakeRifleTable" then
				table.insert(models, model)
			end
		end

		local randomModel = models[math.random(1, #models)]
		rootPart.CFrame = CFrame.new(randomModel:GetPivot().Position)

		local prompt = randomModel.RifleTake.MainPart:FindFirstChild("ProximityPrompt")
		prompt.HoldDuration = 0

		local s = tick()
		while tick() - s < 1 do
			rootPart.CFrame = CFrame.new(randomModel:GetPivot().Position)
			pcall(function() fireproximityprompt(prompt) end)
			task.wait(0.1)
		end

		rootPart.CFrame = CFrame.new(currentposition)
	end,
})

local UnArrestButton = TabDogs:CreateButton({
	Name = "UnArrest All Dogs",
	Callback = function() BreakOutAll() end,
})

TabDogs:CreateSection("Combat & Attack")
TabDogs:CreateToggle({
	Name = "Auto Attack Guards",
	CurrentValue = false,
	Flag = "AutoAttack",
	Callback = function(Value) AutoAttack = Value end,
})

TabDogs:CreateSlider({
	Name = "Auto Attack Range",
	Range = {5, 100},
	Increment = 5,
	Suffix = "studs",
	CurrentValue = 30,
	Flag = "AutoAttackRange",
	Callback = function(Value) AutoAttackRange = Value end,
})

TabDogs:CreateSection("")
local LoopKillDropdown = TabDogs:CreateDropdown({
	Name = "Loop Kill Target",
	Options = GetGuardOptions(),
	CurrentOption = {"No guards found"},
	MultipleOptions = false,
	Flag = "LoopKillDropdown",
	Callback = function(Options)
		local selected = type(Options) == "table" and Options[1] or Options
		if selected == "No guards found" then
			loopKillTarget = nil
			return
		end
		loopKillTarget = Players:FindFirstChild(selected)
	end,
})

task.spawn(function()
	while true do
		task.wait(0.5)
		local newOptions = GetGuardOptions()
		LoopKillDropdown:Refresh(newOptions, true)
	end
end)

TabDogs:CreateToggle({
	Name = "Loop Kill",
	CurrentValue = false,
	Flag = "LoopKill",
	Callback = function(Value)
		LoopKill = Value
		if Value then
			StartLoopKill()
		end
	end,
})

TabDogs:CreateSection("Protections")
TabDogs:CreateToggle({
	Name = "Anti Taser",
	CurrentValue = false,
	Flag = "AntiStunned",
	Callback = function(Value) AntiStunned = Value end,
})

TabDogs:CreateToggle({
	Name = "Anti Muzzle",
	CurrentValue = false,
	Flag = "AntiMuzzle",
	Callback = function(Value) AntiMuzzle = Value end,
})

-- // TAB: MISC
local TabMisc = Window:CreateTab("Misc", "component")

TabMisc:CreateSection("Automation & Utility")
TabMisc:CreateButton({
	Name = "Auto Collect Items",
	Callback = function() AutoCollectItems() end,
})

TabMisc:CreateToggle({
	Name = "Instant Prompts",
	CurrentValue = false,
	Flag = "InstantPrompts",
	Callback = function(Value) ToggleInstantPrompts(Value) end,
})

TabMisc:CreateSection("Healing (Medkit Required)")
TabMisc:CreateToggle({
	Name = "Auto Heal Yourself",
	CurrentValue = false,
	Flag = "AutoHealSelf",
	Callback = function(Value)
		if Value then Rayfield:Notify({ Title = "Important", Content = "You need medkit equipped", Duration = 2.5 }) end
		AutoHealSelf = Value
	end,
})

TabMisc:CreateToggle({
	Name = "Auto Heal Near Players",
	CurrentValue = false,
	Flag = "AutoHealNear",
	Callback = function(Value)
		if Value then Rayfield:Notify({ Title = "Important", Content = "You need medkit equipped", Duration = 2.5 }) end
		AutoHealNear = Value
	end,
})

TabMisc:CreateSection("Combat (Needle Required)")
TabMisc:CreateToggle({
	Name = "Fire All Nearby",
	CurrentValue = false,
	Flag = "FireAll",
	Callback = function(Value)
		if Value then Rayfield:Notify({ Title = "Notification", Content = "Need a Needle equipped.", Duration = 2.5 }) end
		NeedleAll = Value
	end,
})

TabMisc:CreateSection("Character Modifiers")
TabMisc:CreateToggle({
	Name = "Anti Sit",
	CurrentValue = false,
	Flag = "AntiSit",
	Callback = function(Value) AntiSit = Value end,
})

-- // TAB: LOCALPLAYER
local TabLocal = Window:CreateTab("LocalPlayer", "user")

TabLocal:CreateSection("Movement")
local SliderWalkSpeed = TabLocal:CreateSlider({
	Name = "WalkSpeed",
	Range = {0, 150},
	Increment = 1,
	Suffix = "Speed",
	CurrentValue = 16,
	Flag = "SliderSpeed",
	Callback = function(Value)
		if localPlayer.Character then
			localPlayer.Character.Humanoid.WalkSpeed = Value
		end
	end,
})

local SliderJumpPower = TabLocal:CreateSlider({
	Name = "JumpPower",
	Range = {0, 150},
	Increment = 5,
	Suffix = "Power",
	CurrentValue = 50,
	Flag = "SliderJumpPower",
	Callback = function(Value)
		if localPlayer.Character then
			localPlayer.Character.Humanoid.JumpPower = Value
		end
	end,
})

TabLocal:CreateSection("Teleportation")
local DropdownTP = TabLocal:CreateDropdown({
	Name = "TP To...",
	Options = {"dog pound", "Outside the dog pound", "Above the dog pound", "StrayDogs Base"},
	CurrentOption = {"dog pound"},
	MultipleOptions = false,
	Flag = "TPDropdown",
	Callback = function(Options)
		local selected = Options[1] or Options
		MapTp(selected)
	end,
})

-- // TAB: VISUALS
local TabVisuals = Window:CreateTab("Visuals", "eye")

TabVisuals:CreateSection("Player ESP")
TabVisuals:CreateToggle({
	Name = "Enable Esp",
	CurrentValue = false,
	Flag = "EspToggle",
	Callback = function(Value)
		if Value ~= EspEnabled then EspTeams() end
	end,
})

TabVisuals:CreateSection("World Modification")
local RemoveDoorsBut = TabVisuals:CreateButton({
	Name = "Remove Doors",
	Callback = function() RemoveDoors() end,
})

local RemoveTpsbut = TabVisuals:CreateButton({
	Name = "Remove Vet Kick Parts",
	Callback = function() RemoveVetTPS() end,
})

Rayfield:Notify({
	Title = "Notification",
	Content = "imyeh",
	Duration = 6.5,
	Image = 11176073563,
})

Rayfield:LoadConfiguration()
Dog Pound Auto Arrest, Loop Kill, ESP & Auto Heal  Description:
Mobile Friendly
1,183 views
4 months ago

Auto Arrest, Loop Kill, ESP & Auto Heal Description:

WORKING
Free

Description

Dominate Dog Pound with this powerful open-source script featuring Auto Arrest, Loop Kill, ESP, Auto Heal, Anti Muzzle, Anti Taser, Instant Prompts, and more. Play as both Guards and Dogs with advanced automation, combat tools, teleports, and player utilities.

Auto Heal Self

Auto Heal Nearby Players

Fire All Nearby (Needle)

Anti Taser

Anti Muzzle

Anti Sit

Instant Prompts

Auto Collect Items

Leash Selected Player

Become Stray Dog

Team ESP

WalkSpeed Modifier

JumpPower Modifier

Teleport Locations

Remove Doors

Remove Vet Kick Parts

Guard Utilities

Dog Utilities

Open Source

Keyless

SEO Keywords:

Dog Pound Script, Dog Pound Roblox Script, Dog Pound Exploit, Dog Pound Auto Arrest, Dog Pound ESP, Dog Pound Auto Heal, Dog Pound Loop Kill, Dog Pound GUI Script, Dog Pound Keyless Script, Dog Pound Open Source Script, Roblox Dog Pound Script, Dog Pound Auto Attack, Dog Pound Anti Taser, Dog Pound Teleport Script, Dog Pound Auto Collect Items, Dog Pound Guard Script, Dog Pound Dog Script, Dog Pound Admin Script, Dog Pound Hack, Dog Pound Cheat Script.

Features

  • Auto Arrest All Dogs
  • Arrest Selected Player
  • Auto UnArrest / Breakout All Dogs
  • Guard Loop Kill
  • Dog Loop Kill
  • Auto Attack Guards
  • Adjustable Attack Range

Related Scripts