ALT FARM , GIVE BOUNTY, NOW WITHOUT KEY 280k PER HOUR! ()
Key Required

ALT FARM , GIVE BOUNTY, NOW WITHOUT KEY 280k PER HOUR! ()

[⚙️] Criminalitycarlitoskirkcarlitoskirk 1.5K views 2.1K executesUpdated Sep 16, 2026
5.0/ 5(2 votes)
20100% Positive
Lua Script•6084 lines (196081 chars)
-- AUTOFARM: visible startup diagnostics and bounded game dependency waits.
local Players = game:GetService("Players")
local deadline = os.clock() + 20
while not Players.LocalPlayer and os.clock() < deadline do task.wait(0.1) end
local player = Players.LocalPlayer
assert(player, "AUTOFARM requires a running Roblox client with a LocalPlayer")
local playerGui = player:WaitForChild("PlayerGui", 20)
assert(playerGui, "AUTOFARM could not find PlayerGui")
local old = playerGui:FindFirstChild("AutofarmStartup")
if old then old:Destroy() end
local gui = Instance.new("ScreenGui")
gui.Name = "AutofarmStartup"
gui.ResetOnSpawn = false
gui.DisplayOrder = 10000
gui.Parent = playerGui
local label = Instance.new("TextLabel")
label.Size = UDim2.new(0.8, 0, 0, 160)
label.Position = UDim2.new(0.1, 0, 0.08, 0)
label.BackgroundColor3 = Color3.fromRGB(22, 26, 35)
label.TextColor3 = Color3.fromRGB(235, 240, 255)
label.TextSize = 16
label.Font = Enum.Font.Code
label.TextWrapped = true
label.Text = "AUTOFARM — Starting..."
label.Parent = gui
local function report(message)
    label.Text = "AUTOFARM\n" .. tostring(message)
end
task.wait()
local source = [====[
return function(report)
local function requireChild(parent, name)
    report("Waiting for " .. parent:GetFullName() .. "." .. name)
    local child = parent:WaitForChild(name, 15)
    assert(child, "Missing game dependency: " .. parent:GetFullName() .. "." .. name)
    return child
end
-- Hackers Wars: shared farming controls, team pause, and account pause.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local LocalPlayer = Players.LocalPlayer

local TP_INTERVAL = 0.05
local TP_DISTANCE = 3
local PLAYER_REFRESH = 1
local MELEE_DISTANCE = 5
local MELEE_INTERVAL = 0.05

local AUTO_RESPAWN_COOLDOWN = 0.15

local AUTO_TP_POSITION = Vector3.new(
	-4187.00439453125,
	102.6741337890625,
	281.3666076660156
)

local AUTO_TP_RETRY_TIME = 1
local AUTO_TP_STAY_TIME = 10
local AUTO_TP_DISTANCE_THRESHOLD = 12

local AUTO_SAFE_POSITION = Vector3.new(
	-4187.00439453125,
	102.6741337890625,
	281.3666076660156
)

local AUTO_SAFE_STAY_TIME = 5
local AUTO_SAFE_DISTANCE = 12

local E = {giftDamage=false}
local FarmTimerLabel
local FarmEarningsLabel
local SharedParticipants = {}
local SharedAttackTargets = {}
local SharedFinishing = false
local SharedStopAtCap = false
local SharedBountyReached = function() return false end
local SharedHunterRespawn = false
local Body
local selectedPlayer = nil
local teleporting = false
local teleportConnection = nil
local refreshConnection = nil
local lastTeleport = 0
local minimized = false
local destroyed = false

local StopTeleport

local AutoTP_Enabled = false
local AutoTP_Token = 0
local AutoTP_Thread = nil

local AutoSafeEnabled = false
local AutoSafeToken = 0
local AutoSafeThread = nil
local AutoSafeButton = nil

local InfStamina_Enabled = false
local InfStamina_Connection = nil

local function InfStamina_Enable()

	if InfStamina_Enabled then
		return
	end

	InfStamina_Enabled = true

	InfStamina_Connection =
		RunService.RenderStepped:Connect(function()

			if not InfStamina_Enabled then
				return
			end

			local char = LocalPlayer.Character
			local hum = char and char:FindFirstChildOfClass("Humanoid")

			if hum then
				if hum:GetAttribute("ZSPRN_M") ~= true then
					hum:SetAttribute("ZSPRN_M", true)
				end
			end

		end)
end

local function InfStamina_Disable()

	InfStamina_Enabled = false

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

	local char = LocalPlayer.Character
	local hum = char and char:FindFirstChildOfClass("Humanoid")

	if hum then
		hum:SetAttribute("ZSPRN_M", nil)
	end
end

local FistsReset_Enabled = false
local FistsReset_Connection = nil
local FistsReset_Humanoid = nil
local FistsReset_LastHealth = nil
local FistsReset_Ignore = false

local FISTS_DAMAGE = 10
local FISTS_DAMAGE_TOLERANCE = 2

local FISTS_MIN_DAMAGE =
	math.max(
		0,
		FISTS_DAMAGE - FISTS_DAMAGE_TOLERANCE
	)

local FISTS_MAX_DAMAGE =
	FISTS_DAMAGE + FISTS_DAMAGE_TOLERANCE

local function FistsReset_Disconnect()

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

	FistsReset_Humanoid = nil
	FistsReset_LastHealth = nil
end

local function FistsReset_SetCharacter(character)

	if destroyed then
		return
	end

	FistsReset_Disconnect()

	if not FistsReset_Enabled then
		return
	end

	if not character then
		return
	end

	local humanoid =
		character:FindFirstChildOfClass("Humanoid")

	if not humanoid then
		humanoid =
			character:WaitForChild("Humanoid", 10)
	end

	if not humanoid then
		return
	end

	FistsReset_Humanoid = humanoid
	FistsReset_LastHealth = humanoid.Health

	FistsReset_Connection =
		humanoid.HealthChanged:Connect(function(newHealth)

			if destroyed then
				return
			end

			if not FistsReset_Enabled then
				return
			end

			if FistsReset_Ignore then
				FistsReset_LastHealth = newHealth
				return
			end

			local oldHealth =
				FistsReset_LastHealth

			FistsReset_LastHealth = newHealth

			if not oldHealth then
				return
			end

			if newHealth >= oldHealth then
				return
			end

			local damage =
				oldHealth - newHealth

			if (E.giftDamage and damage > 0) or (damage >= FISTS_MIN_DAMAGE
				and damage <= FISTS_MAX_DAMAGE) then

				FistsReset_Ignore = true

				humanoid.Health = 0

				task.defer(function()
					FistsReset_Ignore = false
				end)

			end

		end)
end

local function FistsReset_Enable()

	if destroyed then
		return
	end

	if FistsReset_Enabled then
		return
	end

	FistsReset_Enabled = true

	local character = LocalPlayer.Character

	if character then
		FistsReset_SetCharacter(character)
	end
end

local function FistsReset_Disable()

	FistsReset_Enabled = false

	FistsReset_Disconnect()

	FistsReset_Ignore = false
end

LocalPlayer.CharacterAdded:Connect(function(character)

	if destroyed then
		return
	end

	if FistsReset_Enabled then

		task.spawn(function()

			character:WaitForChild("Humanoid", 10)

			if not destroyed
				and FistsReset_Enabled
				and LocalPlayer.Character == character then

				task.wait(0.1)

				FistsReset_SetCharacter(character)

			end

		end)

	end

end)

local EventsFolder =
	requireChild(ReplicatedStorage, "Events")

local MeleeRemoteFunction =
	requireChild(EventsFolder, "XMHH.2")

local MeleeRemoteEvent =
	requireChild(EventsFolder, "XMHH2.2")

local DeathRespawnFunction =
	requireChild(EventsFolder, "DeathRespawn")

local AutoRespawnConnection = nil
local AutoRespawnBusy = false

local function AutoRespawn()

	if destroyed then
		return
	end

	if E.respawnAllowed and not E.respawnAllowed() then return end
	if not teleporting and not SharedHunterRespawn and not (E.respawnAllowed and E.respawnAllowed()) then
		return
	end

	if AutoRespawnBusy then
		return
	end

	if E.waitForKiller and E.waitForKiller() then return end
	AutoRespawnBusy = true

	local success, result =
		pcall(function()

			return DeathRespawnFunction:InvokeServer(
				"KMG4R904"
			)

		end)

	if not success then

		warn(
			"DeathRespawn InvokeServer failed:",
			result
		)

	end

	task.wait(AUTO_RESPAWN_COOLDOWN)

	AutoRespawnBusy = false
end

AutoRespawnConnection =
	RunService.Heartbeat:Connect(function()

		if destroyed then
			return
		end

		if E.respawnAllowed and not E.respawnAllowed() then return end
	if not teleporting and not SharedHunterRespawn and not (E.respawnAllowed and E.respawnAllowed()) then
			return
		end

		if AutoRespawnBusy then
			return
		end

		local character =
			LocalPlayer.Character

		if not character then
			AutoRespawn()
			return
		end

		local humanoid =
			character:FindFirstChildOfClass(
				"Humanoid"
			)

		if not humanoid then
            E.missingHumanoidSince=E.missingHumanoidSince or os.clock()
            if os.clock()-E.missingHumanoidSince>=1.5 then AutoRespawn() end
            return
        end
        E.missingHumanoidSince=nil

		if humanoid.Health <= 0 then
			AutoRespawn()
		end

	end)

local MeleeAura_Enabled = false
local MeleeAura_Connection = nil
local MeleeAura_LastAttack = 0

local MeleeFistsEquipBusy = false
local MeleeFistsEquipToken = 0
local MeleeFistsEquipConnection = nil

local function GetMeleeFists(character)

	if not character then
		return nil
	end

	local fists =
		character:FindFirstChild("Fists")

	if fists and fists:IsA("Tool") then
		return fists
	end

	local backpack =
		LocalPlayer:FindFirstChildOfClass("Backpack")

	if not backpack then
		return nil
	end

	fists =
		backpack:FindFirstChild("Fists")

	if fists and fists:IsA("Tool") then
		return fists
	end

	return nil
end

local function EquipFistsForMelee()

	if destroyed then
		return
	end

	if not MeleeAura_Enabled then
		return
	end

	if MeleeFistsEquipBusy then
		return
	end

	local character =
		LocalPlayer.Character

	if not character then
		return
	end

	local humanoid =
		character:FindFirstChildOfClass("Humanoid")

	if not humanoid then
		return
	end

	if humanoid.Health <= 0 then
		return
	end

	local equipped =
		character:FindFirstChild("Fists")

	if equipped and equipped:IsA("Tool") then
		return
	end

	local backpack =
		LocalPlayer:FindFirstChildOfClass("Backpack")

	if not backpack then
		return
	end

	local fists =
		backpack:FindFirstChild("Fists")

	if not fists then
		return
	end

	if not fists:IsA("Tool") then
		return
	end

	MeleeFistsEquipBusy = true

	MeleeFistsEquipToken += 1

	local myToken =
		MeleeFistsEquipToken

	task.spawn(function()

		task.wait(0.05)

		if destroyed
			or not MeleeAura_Enabled
			or myToken ~= MeleeFistsEquipToken
			or LocalPlayer.Character ~= character
			or humanoid.Health <= 0 then

			MeleeFistsEquipBusy = false
			return
		end

		if character:FindFirstChild("Fists") then
			MeleeFistsEquipBusy = false
			return
		end

		if not fists.Parent then
			MeleeFistsEquipBusy = false
			return
		end

		humanoid:EquipTool(fists)

		task.wait(0.15)

		MeleeFistsEquipBusy = false

	end)
end

local function StartMeleeFistsMonitor()

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

	MeleeFistsEquipConnection =
		RunService.Heartbeat:Connect(function()

			if destroyed then
				return
			end

			if not MeleeAura_Enabled then
				return
			end

			if MeleeFistsEquipBusy then
				return
			end

			local character =
				LocalPlayer.Character

			if not character then
				return
			end

			local humanoid =
				character:FindFirstChildOfClass(
					"Humanoid"
				)

			if not humanoid then
				return
			end

			if humanoid.Health <= 0 then
				return
			end

			local fists =
				character:FindFirstChild("Fists")

			if not fists then
				EquipFistsForMelee()
			end

		end)
end

local function StopMeleeFistsMonitor()

	MeleeFistsEquipToken += 1

	MeleeFistsEquipBusy = false

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

local function MeleeAttack(target)
    local targetPlayer = target and Players:GetPlayerFromCharacter(target)
    local participant = targetPlayer and SharedParticipants[targetPlayer.UserId]
    if (E.atmPaused and E.atmPaused()) or (SharedStopAtCap and SharedBountyReached()) or not participant or participant.atmTripActive or participant.manualPaused or not SharedAttackTargets[targetPlayer.UserId] or DateTime.now().UnixTimestampMillis / 1000 - participant.updated > 6 then
        return
    end

	if destroyed then
		return
	end

	if not MeleeAura_Enabled then
		return
	end

	if not target then
		return
	end

	local head =
		target:FindFirstChild("Head")

	if not head then
		return
	end

	local char =
		LocalPlayer.Character

	if not char then
		return
	end

	local tool =
		char:FindFirstChildOfClass("Tool")

	local hrp =
		char:FindFirstChild("HumanoidRootPart")

	if not tool or not hrp then
		return
	end

	local hum =
		target:FindFirstChildOfClass("Humanoid")

	if not hum then
		return
	end

	if hum.Health <= (SharedFinishing and 0 or 15) then
		return
	end

	if target:FindFirstChildOfClass("ForceField") then
		return
	end

	local arg1 = {
		[1] = "🍞",
		[2] = tick(),
		[3] = tool,
		[4] = "43TRFWX",
		[5] = "Normal",
		[6] = tick(),
		[7] = true
	}

	local success1, result =
		pcall(function()

			return MeleeRemoteFunction:InvokeServer(
				unpack(arg1)
			)

		end)

	if not success1 then

		warn(
			"Melee Aura: InvokeServer failed:",
			result
		)

		return
	end

	local Handle =
		tool:FindFirstChild("WeaponHandle")
		or tool:FindFirstChild("Handle")

	if not Handle then
		Handle =
			char:FindFirstChild("Right Arm")
	end

	if not Handle then
		return
	end

	local arg2 = {
		[1] = "🍞",
		[2] = tick(),
		[3] = tool,
		[4] = "2389ZFX34",
		[5] = result,
		[6] = false,
		[7] = Handle,
		[8] = head,
		[9] = target,
		[10] = hrp.Position,
		[11] = head.Position
	}

    local latestParticipant = targetPlayer and SharedParticipants[targetPlayer.UserId]
    if (E.atmPaused and E.atmPaused()) or (SharedStopAtCap and SharedBountyReached()) or not MeleeAura_Enabled or destroyed or not latestParticipant or latestParticipant.atmTripActive or latestParticipant.manualPaused or not SharedAttackTargets[targetPlayer.UserId]
        or DateTime.now().UnixTimestampMillis / 1000 - latestParticipant.updated > 6 then
        return
    end
    local success2, errorMsg2 =
		pcall(function()

			MeleeRemoteEvent:FireServer(
				unpack(arg2)
			)

		end)

	if not success2 then

		warn(
			"Melee Aura: FireServer failed:",
			errorMsg2
		)

	end
end

local function MeleeAura_Enable()

	if destroyed then
		return
	end

	if MeleeAura_Enabled then
		return
	end

	MeleeAura_Enabled = true
	MeleeAura_LastAttack = 0

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

	task.spawn(function()

		task.wait(0.1)

		if not destroyed
			and MeleeAura_Enabled then

			EquipFistsForMelee()

		end

	end)

	StartMeleeFistsMonitor()

	MeleeAura_Connection =
		RunService.RenderStepped:Connect(function()

			if destroyed then
				return
			end

			if not MeleeAura_Enabled then
				return
			end

			if not MeleeFistsEquipBusy then
				local character =
					LocalPlayer.Character

				if character then

					local humanoid =
						character:FindFirstChildOfClass(
							"Humanoid"
						)

					if humanoid
						and humanoid.Health > 0
						and not character:FindFirstChild("Fists") then

						EquipFistsForMelee()

					end

				end
			end

			local currentTime =
				tick()

			if currentTime - MeleeAura_LastAttack
				< MELEE_INTERVAL then

				return
			end

			local char =
				LocalPlayer.Character

			if not char then
				return
			end

			local hrp =
				char:FindFirstChild(
					"HumanoidRootPart"
				)

			if not hrp then
				return
			end

			for _, player in ipairs(
				Players:GetPlayers()
			) do

				if player ~= LocalPlayer and SharedParticipants[player.UserId] and SharedAttackTargets[player.UserId] then

					local targetCharacter =
						player.Character

					local targetHRP =
						targetCharacter
						and targetCharacter:FindFirstChild(
							"HumanoidRootPart"
						)

					local targetHum =
						targetCharacter
						and targetCharacter:FindFirstChildOfClass(
							"Humanoid"
						)

					if targetHRP and targetHum then

						local distance =
							(
								hrp.Position
								- targetHRP.Position
							).Magnitude

						if distance <= MELEE_DISTANCE
							and targetHum.Health > (SharedFinishing and 0 or 15)
							and not targetCharacter:FindFirstChildOfClass(
								"ForceField"
							) then

							MeleeAura_LastAttack =
								currentTime

							MeleeAttack(
								targetCharacter
							)

							break
						end
					end
				end
			end
		end)
end

local function MeleeAura_Disable()

	MeleeAura_Enabled = false

	StopMeleeFistsMonitor()

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

local FistsEquipMonitor = nil
local FistsForceFieldConnection = nil
local FistsEquipBusy = false
local FistsEquipToken = 0
local FistsReequipBusy = false
local FistsReequipToken = 0

local function GetFists(character)

	if not character then
		return nil
	end

	local fists =
		character:FindFirstChild("Fists")

	if fists and fists:IsA("Tool") then
		return fists
	end

	local backpack =
		LocalPlayer:FindFirstChildOfClass("Backpack")

	if backpack then

		fists =
			backpack:FindFirstChild("Fists")

		if fists and fists:IsA("Tool") then
			return fists
		end
	end

	return nil
end

local function EquipFists(character)

	if destroyed then
		return
	end

	if (not teleporting and not E.giftDamage) then
		return
	end

	if FistsEquipBusy then
		return
	end

	character =
		character or LocalPlayer.Character

	if not character
		or LocalPlayer.Character ~= character then

		return
	end

	local humanoid =
		character:FindFirstChildOfClass("Humanoid")

	if not humanoid then

		humanoid =
			character:WaitForChild(
				"Humanoid",
				10
			)
	end

	if not humanoid
		or humanoid.Health <= 0 then

		return
	end

	local equippedFists =
		character:FindFirstChild("Fists")

	if equippedFists
		and equippedFists:IsA("Tool") then

		return
	end

	local backpack =
		LocalPlayer:FindFirstChildOfClass("Backpack")

	if not backpack then
		return
	end

	local fists =
		backpack:FindFirstChild("Fists")

	if not fists then
		return
	end

	if not fists:IsA("Tool") then
		return
	end

	FistsEquipBusy = true
	FistsEquipToken += 1

	local myToken =
		FistsEquipToken

	task.wait(0.1)

	if destroyed
		or myToken ~= FistsEquipToken
		or (not teleporting and not E.giftDamage)
		or LocalPlayer.Character ~= character
		or humanoid.Health <= 0 then

		FistsEquipBusy = false
		return
	end

	if character:FindFirstChild("Fists") then
		FistsEquipBusy = false
		return
	end

	if not fists.Parent then
		FistsEquipBusy = false
		return
	end

	humanoid:EquipTool(fists)

	task.wait(0.15)

	FistsEquipBusy = false
end

local function ForceReequipFists(character)

	if destroyed then
		return
	end

	if (not teleporting and not E.giftDamage) then
		return
	end

	if FistsReequipBusy then
		return
	end

	if not character
		or LocalPlayer.Character ~= character then

		return
	end

	local humanoid =
		character:FindFirstChildOfClass("Humanoid")

	if not humanoid
		or humanoid.Health <= 0 then

		return
	end

	local forceField =
		character:FindFirstChildOfClass("ForceField")

	local fists =
		character:FindFirstChild("Fists")

	if not forceField
		or not fists
		or not fists:IsA("Tool") then

		return
	end

	FistsReequipBusy = true

	FistsReequipToken += 1

	local myToken =
		FistsReequipToken

	humanoid:UnequipTools()

	task.wait(0.1)

	if destroyed
		or myToken ~= FistsReequipToken
		or (not teleporting and not E.giftDamage)
		or LocalPlayer.Character ~= character
		or humanoid.Health <= 0 then

		FistsReequipBusy = false
		return
	end

	local backpack =
		LocalPlayer:FindFirstChildOfClass(
			"Backpack"
		)

	if not backpack then
		FistsReequipBusy = false
		return
	end

	local fistsInBackpack =
		backpack:FindFirstChild("Fists")

	if not fistsInBackpack
		or not fistsInBackpack:IsA("Tool") then

		FistsReequipBusy = false
		return
	end

	humanoid:EquipTool(fistsInBackpack)

	task.wait(0.15)

	FistsReequipBusy = false
end

local function SetupForceFieldMonitor(character)

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

	if not character then
		return
	end

	FistsForceFieldConnection =
		character.ChildAdded:Connect(function(child)

			if destroyed then
				return
			end

			if not teleporting then
				return
			end

			if child:IsA("ForceField") then

				task.defer(function()

					if destroyed then
						return
					end

					if not teleporting then
						return
					end

					if LocalPlayer.Character ~= character then
						return
					end

					task.wait(0.05)

					ForceReequipFists(character)

				end)

			end
		end)

	task.defer(function()

		if destroyed then
			return
		end

		if not teleporting then
			return
		end

		if LocalPlayer.Character ~= character then
			return
		end

		if character:FindFirstChildOfClass("ForceField")
			and character:FindFirstChild("Fists") then

			ForceReequipFists(character)

		end

	end)
end

LocalPlayer.CharacterAdded:Connect(function(character)

	if destroyed then
		return
	end

	FistsEquipToken += 1
	FistsReequipToken += 1

	FistsEquipBusy = false
	FistsReequipBusy = false

	SetupForceFieldMonitor(character)

	task.spawn(function()

		local humanoid =
			character:WaitForChild(
				"Humanoid",
				10
			)

		if not humanoid then
			return
		end

		local backpack =
			LocalPlayer:WaitForChild(
				"Backpack",
				10
			)

		if not backpack then
			return
		end

		task.wait(0.5)

		if not destroyed
			and MeleeAura_Enabled
			and LocalPlayer.Character == character
			and humanoid.Health > 0 then

			EquipFistsForMelee()

		end

	end)

	task.spawn(function()

		local humanoid =
			character:WaitForChild(
				"Humanoid",
				10
			)

		if not humanoid then
			return
		end

		local backpack =
			LocalPlayer:WaitForChild(
				"Backpack",
				10
			)

		if not backpack then
			return
		end

		task.wait(0.5)

		if not teleporting then
			return
		end

		for _ = 1, 20 do

			if destroyed
				or not teleporting
				or LocalPlayer.Character ~= character
				or humanoid.Health <= 0 then

				break
			end

			if character:FindFirstChild("Fists") then
				break
			end

			local fists =
				backpack:FindFirstChild("Fists")

			if fists
				and fists:IsA("Tool") then

				EquipFists(character)
				break
			end

			task.wait(0.25)

		end
	end)

end)

FistsEquipMonitor =
	RunService.Heartbeat:Connect(function()

		if destroyed then
			return
		end

		if not teleporting then
			return
		end

		local character =
			LocalPlayer.Character

		if not character then
			return
		end

		local humanoid =
			character:FindFirstChildOfClass(
				"Humanoid"
			)

		if not humanoid
			or humanoid.Health <= 0 then

			return
		end

		local forceField =
			character:FindFirstChildOfClass(
				"ForceField"
			)

		local equippedFists =
			character:FindFirstChild("Fists")

		if forceField
			and equippedFists
			and equippedFists:IsA("Tool") then

			ForceReequipFists(character)
			return
		end

		if FistsEquipBusy
			or FistsReequipBusy then

			return
		end

		if not equippedFists then

			local backpack =
				LocalPlayer:FindFirstChildOfClass(
					"Backpack"
				)

			if not backpack then
				return
			end

			local fists =
				backpack:FindFirstChild("Fists")

			if not fists
				or not fists:IsA("Tool") then

				return
			end

			EquipFists(character)
		end

	end)

if LocalPlayer.Character then

	local character =
		LocalPlayer.Character

	SetupForceFieldMonitor(character)

	if teleporting then

		task.spawn(function()

			task.wait(0.5)

			if not destroyed
				and teleporting
				and LocalPlayer.Character == character then

				EquipFists(character)

			end

		end)

	end

	if MeleeAura_Enabled then

		task.spawn(function()

			task.wait(0.5)

			if not destroyed
				and MeleeAura_Enabled
				and LocalPlayer.Character == character then

				EquipFistsForMelee()

			end

		end)

	end
end

local AutoTPButton

local function GetMyRoot()

	local character =
		LocalPlayer.Character

	if not character then
		return nil
	end

	return character:FindFirstChild(
		"HumanoidRootPart"
	)
end

local function AutoTP_Teleport()

	if destroyed
		or not AutoTP_Enabled then

		return false
	end

	local character =
		LocalPlayer.Character

	if not character then
		return false
	end

	local humanoid =
		character:FindFirstChildOfClass("Humanoid")

	local root =
		character:FindFirstChild("HumanoidRootPart")

	if not humanoid or not root then
		return false
	end

	if humanoid.Health <= 0 then
		return false
	end

	root.CFrame =
		CFrame.new(AUTO_TP_POSITION)

	return true
end

local function AutoTP_Disable()

	AutoTP_Enabled = false
	AutoTP_Token += 1
	AutoTP_Thread = nil

	if not destroyed
		and AutoTPButton then

		AutoTPButton.Text =
			"SAFE LOCATION TP: OFF"

		AutoTPButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				60,
				78
			)
	end
end

local function AutoTP_Enable()

	if destroyed then
		return
	end

	if AutoTP_Enabled then
		return
	end

	AutoTP_Enabled = true

	AutoTP_Token += 1

	local myToken =
		AutoTP_Token

	AutoTP_Thread =
		task.spawn(function()

			local stayStart = nil

			while not destroyed
				and AutoTP_Enabled
				and myToken == AutoTP_Token do

				local character =
					LocalPlayer.Character

				if not character then

					stayStart = nil

					task.wait(0.1)

					continue
				end

				local humanoid =
					character:FindFirstChildOfClass(
						"Humanoid"
					)

				local root =
					character:FindFirstChild(
						"HumanoidRootPart"
					)

				if not humanoid or not root then

					stayStart = nil

					task.wait(0.1)

					continue
				end

				if humanoid.Health <= 0 then

					stayStart = nil

					task.wait(0.1)

					continue
				end

				AutoTP_Teleport()

				task.wait(0.15)

				if destroyed
					or not AutoTP_Enabled
					or myToken ~= AutoTP_Token then

					break
				end

				root = GetMyRoot()

				if not root then

					stayStart = nil

					task.wait(0.1)

					continue
				end

				if (
					root.Position
					- AUTO_TP_POSITION
				).Magnitude
					<= AUTO_TP_DISTANCE_THRESHOLD then

					if not stayStart then
						stayStart = tick()
					end

				else

					stayStart = nil

				end

				local cycleStart =
					tick()

				while tick() - cycleStart
					< AUTO_TP_RETRY_TIME do

					if destroyed
						or not AutoTP_Enabled
						or myToken ~= AutoTP_Token then

						break
					end

					character =
						LocalPlayer.Character

					if not character then

						stayStart = nil
						break
					end

					humanoid =
						character:FindFirstChildOfClass(
							"Humanoid"
						)

					root =
						character:FindFirstChild(
							"HumanoidRootPart"
						)

					if not humanoid
						or not root
						or humanoid.Health <= 0 then

						stayStart = nil
						break
					end

					local distance =
						(
							root.Position
							- AUTO_TP_POSITION
						).Magnitude

					if distance
						<= AUTO_TP_DISTANCE_THRESHOLD then

						if not stayStart then
							stayStart = tick()
						end

						if tick() - stayStart
							>= AUTO_TP_STAY_TIME then

							AutoTP_Disable()

							break
						end

					else

						stayStart = nil

					end

					task.wait(0.05)
				end

				if destroyed
					or not AutoTP_Enabled
					or myToken ~= AutoTP_Token then

					break
				end

				root = GetMyRoot()

				if root then

					local distance =
						(
							root.Position
							- AUTO_TP_POSITION
						).Magnitude

					if distance
						> AUTO_TP_DISTANCE_THRESHOLD then

						stayStart = nil
					end

				else

					stayStart = nil
				end
			end
		end)
end

local function AutoSafeGetRoot()

	local character =
		LocalPlayer.Character

	if not character then
		return nil
	end

	return character:FindFirstChild(
		"HumanoidRootPart"
	)
end

local function AutoSafeTeleport()

	if destroyed
		or not AutoSafeEnabled then

		return false
	end

	local character =
		LocalPlayer.Character

	if not character then
		return false
	end

	local humanoid =
		character:FindFirstChildOfClass(
			"Humanoid"
		)

	local root =
		character:FindFirstChild(
			"HumanoidRootPart"
		)

	if not humanoid or not root then
		return false
	end

	if humanoid.Health <= 0 then
		return false
	end

	root.CFrame =
		CFrame.new(AUTO_SAFE_POSITION)

	return true
end

local function AutoSafeUpdateButton()

	if destroyed
		or not AutoSafeButton then

		return
	end

	if AutoSafeEnabled then

		AutoSafeButton.Text =
			"AUTO SAFE LOCATION: ON"

		AutoSafeButton.BackgroundColor3 =
			Color3.fromRGB(
				50,
				150,
				90
			)

	else

		AutoSafeButton.Text =
			"AUTO SAFE LOCATION: OFF"

		AutoSafeButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				60,
				78
			)

	end
end

local function AutoSafe_Disable()

	AutoSafeEnabled = false

	AutoSafeToken += 1
	AutoSafeThread = nil

	AutoSafeUpdateButton()
end

local function AutoSafe_Enable()

	if destroyed then
		return
	end

	if AutoSafeEnabled then
		return
	end

	AutoSafeEnabled = true

	AutoSafeToken += 1

	local myToken =
		AutoSafeToken

	AutoSafeUpdateButton()

	AutoSafeThread =
		task.spawn(function()

			while not destroyed
				and AutoSafeEnabled
				and myToken == AutoSafeToken do

				local character =
					LocalPlayer.Character

				if not character then

					task.wait(0.1)

					continue
				end

				local humanoid =
					character:FindFirstChildOfClass(
						"Humanoid"
					)

				if not humanoid then

					task.wait(0.1)

					continue
				end

				if humanoid.Health <= 0 then

					task.wait(0.1)

					continue
				end

				local root =
					character:FindFirstChild(
						"HumanoidRootPart"
					)

				if not root then

					task.wait(0.1)

					continue
				end

				AutoSafeTeleport()

				task.wait(0.15)

				if destroyed
					or not AutoSafeEnabled
					or myToken ~= AutoSafeToken then

					break
				end

				local stayStart =
					tick()

				while tick() - stayStart
					< AUTO_SAFE_STAY_TIME do

					if destroyed
						or not AutoSafeEnabled
						or myToken ~= AutoSafeToken then

						return
					end

					character =
						LocalPlayer.Character

					if not character then
						break
					end

					humanoid =
						character:FindFirstChildOfClass(
							"Humanoid"
						)

					root =
						character:FindFirstChild(
							"HumanoidRootPart"
						)

					if not humanoid
						or not root
						or humanoid.Health <= 0 then

						break
					end

					task.wait(0.05)
				end

				if destroyed
					or not AutoSafeEnabled
					or myToken ~= AutoSafeToken then

					break
				end

				character =
					LocalPlayer.Character

				if not character then
					continue
				end

				humanoid =
					character:FindFirstChildOfClass(
						"Humanoid"
					)

				root =
					character:FindFirstChild(
						"HumanoidRootPart"
					)

				if not humanoid
					or not root
					or humanoid.Health <= 0 then

					continue
				end

				humanoid.Jump = true

				task.wait(0.15)

				if destroyed
					or not AutoSafeEnabled
					or myToken ~= AutoSafeToken then

					break
				end

				root =
					AutoSafeGetRoot()

				if not root then
					continue
				end

				local distance =
					(
						root.Position
						- AUTO_SAFE_POSITION
					).Magnitude

				if distance > AUTO_SAFE_DISTANCE then

					AutoSafeTeleport()

				end

				task.wait(0.15)
			end
		end)
end

local ScreenGui =
	Instance.new("ScreenGui")

ScreenGui.AutoLocalize = false
ScreenGui.DisplayOrder = 2147483647
ScreenGui.Name =
	"PlayerTeleportGUI"

ScreenGui.ResetOnSpawn =
	false

ScreenGui.Parent =
	LocalPlayer:WaitForChild("PlayerGui")

local BountyFrame =
	Instance.new("Frame")

BountyFrame.Name =
	"BountyFrame"

BountyFrame.Size =
	UDim2.new(
		0,
		220,
		0,
		55
	)

BountyFrame.Position =
	UDim2.new(
		0.5,
		-110,
		0,
		20
	)

BountyFrame.BackgroundColor3 =
	Color3.fromRGB(
		20,
		22,
		30
	)

BountyFrame.BorderSizePixel = 0
BountyFrame.Parent = ScreenGui

local BountyCorner =
	Instance.new("UICorner")

BountyCorner.CornerRadius =
	UDim.new(0, 12)

BountyCorner.Parent =
	BountyFrame

local BountyStroke =
	Instance.new("UIStroke")

BountyStroke.Color =
	Color3.fromRGB(
		70,
		75,
		100
	)

BountyStroke.Thickness = 1.5
BountyStroke.Parent = BountyFrame

local BountyTitle =
	Instance.new("TextLabel")

BountyTitle.Name =
	"Title"

BountyTitle.Size =
	UDim2.new(
		0.5,
		0,
		1,
		0
	)

BountyTitle.Position =
	UDim2.new(
		0,
		12,
		0,
		0
	)

BountyTitle.BackgroundTransparency = 1

BountyTitle.Text =
	"BOUNTY"

BountyTitle.TextColor3 =
	Color3.fromRGB(
		180,
		185,
		205
	)

BountyTitle.TextSize = 15

BountyTitle.Font =
	Enum.Font.GothamBold

BountyTitle.TextXAlignment =
	Enum.TextXAlignment.Left

BountyTitle.Parent =
	BountyFrame

local BountyValue =
	Instance.new("TextLabel")

BountyValue.Name =
	"Value"

BountyValue.Size =
	UDim2.new(
		0.5,
		-12,
		1,
		0
	)

BountyValue.Position =
	UDim2.new(
		0.5,
		0,
		0,
		0
	)

BountyValue.BackgroundTransparency = 1

BountyValue.Text =
	"0"

BountyValue.TextColor3 =
	Color3.fromRGB(
		255,
		220,
		80
	)

BountyValue.TextSize = 17

BountyValue.Font =
	Enum.Font.GothamBold

BountyValue.TextXAlignment =
	Enum.TextXAlignment.Right

BountyValue.Parent =
	BountyFrame

local function GetOriginalBountyLabel()

	local playerGui =
		LocalPlayer:FindFirstChild(
			"PlayerGui"
		)

	if not playerGui then
		return nil
	end

	local coreGUI =
		playerGui:FindFirstChild(
			"CoreGUI"
		)

	if not coreGUI then
		return nil
	end

	local statsFrame =
		coreGUI:FindFirstChild(
			"StatsFrame"
		)

	if not statsFrame then
		return nil
	end

	local frame2 =
		statsFrame:FindFirstChild(
			"Frame2"
		)

	if not frame2 then
		return nil
	end

	local frame =
		frame2:FindFirstChild(
			"Frame"
		)

	if not frame then
		return nil
	end

	local container =
		frame:FindFirstChild(
			"Container"
		)

	if not container then
		return nil
	end

	local bounty =
		container:FindFirstChild(
			"Bounty"
		)

	if not bounty then
		return nil
	end

	local amt =
		bounty:FindFirstChild(
			"Amt"
		)

	if not amt
		or not amt:IsA("TextLabel") then

		return nil
	end

	return amt
end

local BountyConnection = nil

local function UpdateBounty()

	if destroyed then
		return
	end

	local bountyLabel =
		GetOriginalBountyLabel()

	if bountyLabel then

		BountyValue.Text =
			bountyLabel.Text

	else

		BountyValue.Text =
			"0"

	end
end

local function ConnectBounty()

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

	local bountyLabel =
		GetOriginalBountyLabel()

	if not bountyLabel then
		return
	end

	BountyValue.Text =
		bountyLabel.Text

	BountyConnection =
		bountyLabel:GetPropertyChangedSignal(
			"Text"
		):Connect(function()

			if destroyed then
				return
			end

			BountyValue.Text =
				bountyLabel.Text

		end)
end

task.spawn(function()

	while not destroyed do

		local bountyLabel =
			GetOriginalBountyLabel()

		if bountyLabel then

			ConnectBounty()
			UpdateBounty()

			break
		end

		task.wait(0.5)
	end
end)

LocalPlayer.PlayerGui.ChildAdded:Connect(
	function(child)

		if destroyed then
			return
		end

		if child.Name == "CoreGUI" then

			task.wait(0.2)

			ConnectBounty()
			UpdateBounty()
		end
	end
)

local Main =
	Instance.new("Frame")

Main.Name =
	"Main"

Main.Size =
	UDim2.new(
		0,
		350,
		0,
		550
	)

Main.Position =
	UDim2.new(
		0.5,
		-175,
		0.5,
		-275
	)

Main.BackgroundColor3 =
	Color3.fromRGB(
		20,
		22,
		30
	)

Main.BorderSizePixel = 0
Main.Parent = ScreenGui

local MainCorner =
	Instance.new("UICorner")

MainCorner.CornerRadius =
	UDim.new(0, 14)

MainCorner.Parent =
	Main

local MainStroke =
	Instance.new("UIStroke")

MainStroke.Color =
	Color3.fromRGB(
		70,
		75,
		100
	)

MainStroke.Thickness = 1.5
MainStroke.Parent = Main

local TopBar =
	Instance.new("Frame")

TopBar.Size =
	UDim2.new(
		1,
		0,
		0,
		55
	)

TopBar.BackgroundTransparency = 1
TopBar.Parent = Main

local Title =
	Instance.new("TextLabel")

Title.Size =
	UDim2.new(
		1,
		-120,
		1,
		0
	)

Title.Position =
	UDim2.new(
		0,
		15,
		0,
		0
	)

Title.BackgroundTransparency = 1

Title.Text =
	"AUTOFARM"

Title.TextColor3 =
	Color3.fromRGB(
		255,
		255,
		255
	)

Title.TextSize = 20

Title.TextXAlignment =
	Enum.TextXAlignment.Left

Title.Font =
	Enum.Font.GothamBold

Title.Parent =
	TopBar

local MinimizeButton =
	Instance.new("TextButton")

MinimizeButton.Size =
	UDim2.new(
		0,
		40,
		0,
		35
	)

MinimizeButton.Position =
	UDim2.new(
		1,
		-90,
		0,
		10
	)

MinimizeButton.BackgroundColor3 =
	Color3.fromRGB(
		45,
		48,
		62
	)

MinimizeButton.Text =
	"—"

MinimizeButton.TextColor3 =
	Color3.fromRGB(
		255,
		255,
		255
	)

MinimizeButton.TextSize = 20

MinimizeButton.Font =
	Enum.Font.GothamBold

MinimizeButton.Parent =
	TopBar

local MinCorner =
	Instance.new("UICorner")

MinCorner.CornerRadius =
	UDim.new(0, 8)

MinCorner.Parent =
	MinimizeButton

local DeleteButton =
	Instance.new("TextButton")

DeleteButton.Size =
	UDim2.new(
		0,
		40,
		0,
		35
	)

DeleteButton.Position =
	UDim2.new(
		1,
		-45,
		0,
		10
	)

DeleteButton.BackgroundColor3 =
	Color3.fromRGB(
		170,
		50,
		60
	)

DeleteButton.Text =
	"X"

DeleteButton.TextColor3 =
	Color3.fromRGB(
		255,
		255,
		255
	)

DeleteButton.TextSize = 15

DeleteButton.Font =
	Enum.Font.GothamBold

DeleteButton.Parent =
	TopBar

local DeleteCorner =
	Instance.new("UICorner")

DeleteCorner.CornerRadius =
	UDim.new(0, 8)

DeleteCorner.Parent =
	DeleteButton

local Subtitle =
	Instance.new("TextLabel")

Subtitle.Size =
	UDim2.new(
		1,
		-30,
		0,
		25
	)

Subtitle.Position =
	UDim2.new(
		0,
		15,
		0,
		55
	)

Subtitle.BackgroundTransparency = 1

Subtitle.Text =
	"Select a player"

Subtitle.TextColor3 =
	Color3.fromRGB(
		150,
		155,
		175
	)

Subtitle.TextSize = 13

Subtitle.Font =
	Enum.Font.Gotham

Subtitle.TextXAlignment =
	Enum.TextXAlignment.Left

Subtitle.Parent =
	Main

local SelectedLabel =
	Instance.new("TextLabel")

SelectedLabel.Size =
	UDim2.new(
		1,
		-30,
		0,
		38
	)

SelectedLabel.Position =
	UDim2.new(
		0,
		15,
		0,
		88
	)

SelectedLabel.BackgroundColor3 =
	Color3.fromRGB(
		28,
		31,
		42
	)

SelectedLabel.Text =
	"Player: None"

SelectedLabel.TextColor3 =
	Color3.fromRGB(
		200,
		205,
		220
	)

SelectedLabel.TextSize = 14

SelectedLabel.Font =
	Enum.Font.GothamMedium

SelectedLabel.Parent =
	Main

local SelectedCorner =
	Instance.new("UICorner")

SelectedCorner.CornerRadius =
	UDim.new(0, 8)

SelectedCorner.Parent =
	SelectedLabel

local StaminaButton =
	Instance.new("TextButton")

StaminaButton.Name =
	"StaminaButton"

StaminaButton.Size =
	UDim2.new(
		1,
		-30,
		0,
		42
	)

StaminaButton.Position =
	UDim2.new(
		0,
		15,
		0,
		135
	)

StaminaButton.BackgroundColor3 =
	Color3.fromRGB(
		55,
		60,
		78
	)

StaminaButton.Text =
	"STAMINA: OFF"

StaminaButton.TextColor3 =
	Color3.fromRGB(
		220,
		220,
		230
	)

StaminaButton.TextSize = 14

StaminaButton.Font =
	Enum.Font.GothamBold

StaminaButton.Parent =
	Main

local StaminaCorner =
	Instance.new("UICorner")

StaminaCorner.CornerRadius =
	UDim.new(0, 9)

StaminaCorner.Parent =
	StaminaButton

local MeleeButton =
	Instance.new("TextButton")

MeleeButton.Name =
	"MeleeAuraButton"

MeleeButton.Size =
	UDim2.new(
		1,
		-30,
		0,
		42
	)

MeleeButton.Position =
	UDim2.new(
		0,
		15,
		0,
		185
	)

MeleeButton.BackgroundColor3 =
	Color3.fromRGB(
		55,
		60,
		78
	)

MeleeButton.Text =
	"MELEE AURA: OFF"

MeleeButton.TextColor3 =
	Color3.fromRGB(
		220,
		220,
		230
	)

MeleeButton.TextSize = 14

MeleeButton.Font =
	Enum.Font.GothamBold

MeleeButton.Parent =
	Main

local MeleeCorner =
	Instance.new("UICorner")

MeleeCorner.CornerRadius =
	UDim.new(0, 9)

MeleeCorner.Parent =
	MeleeButton

AutoTPButton =
	Instance.new("TextButton")

AutoTPButton.Name =
	"SafeTPButton"

AutoTPButton.Size =
	UDim2.new(
		1,
		-30,
		0,
		42
	)

AutoTPButton.Position =
	UDim2.new(
		0,
		15,
		0,
		235
	)

AutoTPButton.BackgroundColor3 =
	Color3.fromRGB(
		55,
		60,
		78
	)

AutoTPButton.Text =
	"SAFE LOCATION TP: OFF"

AutoTPButton.TextColor3 =
	Color3.fromRGB(
		220,
		220,
		230
	)

AutoTPButton.TextSize = 14

AutoTPButton.Font =
	Enum.Font.GothamBold

AutoTPButton.Parent =
	Main

local AutoTPCorner =
	Instance.new("UICorner")

AutoTPCorner.CornerRadius =
	UDim.new(0, 9)

AutoTPCorner.Parent =
	AutoTPButton

AutoSafeButton =
	Instance.new("TextButton")

AutoSafeButton.Name =
	"AutoSafeButton"

AutoSafeButton.Size =
	UDim2.new(
		1,
		-30,
		0,
		42
	)

AutoSafeButton.Position =
	UDim2.new(
		0,
		15,
		0,
		285
	)

AutoSafeButton.BackgroundColor3 =
	Color3.fromRGB(
		55,
		60,
		78
	)

AutoSafeButton.Text =
	"AUTO SAFE LOCATION: OFF"

AutoSafeButton.TextColor3 =
	Color3.fromRGB(
		220,
		220,
		230
	)

AutoSafeButton.TextSize = 14

AutoSafeButton.Font =
	Enum.Font.GothamBold

AutoSafeButton.Parent =
	Main

local AutoSafeCorner =
	Instance.new("UICorner")

AutoSafeCorner.CornerRadius =
	UDim.new(0, 9)

AutoSafeCorner.Parent =
	AutoSafeButton

local function UpdateStaminaButton()

	if destroyed then
		return
	end

	if InfStamina_Enabled then

		StaminaButton.Text =
			"STAMINA: ON"

		StaminaButton.BackgroundColor3 =
			Color3.fromRGB(
				50,
				150,
				90
			)

	else

		StaminaButton.Text =
			"STAMINA: OFF"

		StaminaButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				60,
				78
			)
	end
end

local function UpdateMeleeButton()

	if destroyed then
		return
	end

	if MeleeAura_Enabled then

		MeleeButton.Text =
			"MELEE AURA: ON"

		MeleeButton.BackgroundColor3 =
			Color3.fromRGB(
				180,
				75,
				55
			)

	else

		MeleeButton.Text =
			"MELEE AURA: OFF"

		MeleeButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				60,
				78
			)
	end
end

local function UpdateAutoTPButton()

	if destroyed then
		return
	end

	if AutoTP_Enabled then

		AutoTPButton.Text =
			"SAFE LOCATION TP: ON"

		AutoTPButton.BackgroundColor3 =
			Color3.fromRGB(
				50,
				150,
				90
			)

	else

		AutoTPButton.Text =
			"SAFE LOCATION TP: OFF"

		AutoTPButton.BackgroundColor3 =
			Color3.fromRGB(
				55,
				60,
				78
			)
	end
end

StaminaButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if InfStamina_Enabled then
		InfStamina_Disable()
	else
		InfStamina_Enable()
	end

	UpdateStaminaButton()
end)

MeleeButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if MeleeAura_Enabled then
		MeleeAura_Disable()
	else
		MeleeAura_Enable()
	end

	UpdateMeleeButton()
end)

AutoTPButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if AutoTP_Enabled then
		AutoTP_Disable()
	else
		AutoTP_Enable()
	end

	UpdateAutoTPButton()
end)

AutoSafeButton.MouseButton1Click:Connect(function()

	if destroyed then
		return
	end

	if AutoSafeEnabled then
		AutoSafe_Disable()
	else
		AutoSafe_Enable()
	end

end)

local PlayerList =
	Instance.new("ScrollingFrame")

PlayerList.Name =
	"PlayerList"

PlayerList.Size =
	UDim2.new(
		1,
		-30,
		0,
		150
	)

PlayerList.Position =
	UDim2.new(
		0,
		15,
		0,
		335
	)

PlayerList.BackgroundColor3 =
	Color3.fromRGB(
		25,
		27,
		37
	)

PlayerList.BorderSizePixel = 0

PlayerList.ScrollBarThickness = 5

PlayerList.ScrollBarImageColor3 =
	Color3.fromRGB(
		90,
		95,
		125
	)

PlayerList.CanvasSize =
	UDim2.new(
		0,
		0,
		0,
		0
	)

PlayerList.Parent =
	Main

local ListCorner =
	Instance.new("UICorner")

ListCorner.CornerRadius =
	UDim.new(0, 10)

ListCorner.Parent =
	PlayerList

local Layout =
	Instance.new("UIListLayout")

Layout.Padding =
	UDim.new(0, 6)

Layout.HorizontalAlignment =
	Enum.HorizontalAlignment.Center

Layout.SortOrder =
	Enum.SortOrder.Name

Layout.Parent =
	PlayerList

local Padding =
	Instance.new("UIPadding")

Padding.PaddingTop =
	UDim.new(0, 8)

Padding.PaddingBottom =
	UDim.new(0, 8)

Padding.Parent =
	PlayerList

local StopButton =
	Instance.new("TextButton")

StopButton.Size =
	UDim2.new(
		1,
		-30,
		0,
		42
	)

StopButton.Position =
	UDim2.new(
		0,
		15,
		1,
		-57
	)

StopButton.BackgroundColor3 =
	Color3.fromRGB(
		180,
		55,
		65
	)

StopButton.Text =
	"PAUSE TP"

StopButton.TextColor3 =
	Color3.fromRGB(
		255,
		255,
		255
	)

StopButton.TextSize = 14

StopButton.Font =
	Enum.Font.GothamBold

StopButton.Parent =
	Main

local StopCorner =
	Instance.new("UICorner")

StopCorner.CornerRadius =
	UDim.new(0, 9)

StopCorner.Parent =
	StopButton

local function UpdateCanvas()

	PlayerList.CanvasSize =
		UDim2.new(
			0,
			0,
			0,
			Layout.AbsoluteContentSize.Y + 16
		)
end

Layout:GetPropertyChangedSignal(
	"AbsoluteContentSize"
):Connect(UpdateCanvas)

StopTeleport = function()

	teleporting = false

	selectedPlayer = nil

	if teleportConnection then

		teleportConnection:Disconnect()

		teleportConnection = nil
	end

	AutoRespawnBusy = false

	FistsReset_Disable()

	if not destroyed then

		SelectedLabel.Text =
			"Player: None"

		SelectedLabel.TextColor3 =
			Color3.fromRGB(
				200,
				205,
				220
			)
	end
end

local function StartTeleport(player)

	if destroyed then
		return
	end

	if not player
		or player == LocalPlayer then

		return
	end

	if teleportConnection then

		teleportConnection:Disconnect()

		teleportConnection = nil
	end

	selectedPlayer = player
	teleporting = true

	FistsReset_Enable()

	SelectedLabel.Text =
		"Player: " ..
		player.DisplayName

	SelectedLabel.TextColor3 =
		Color3.fromRGB(
			100,
			220,
			150
		)

	lastTeleport = 0

	task.spawn(function()

		task.wait(0.1)

		if not destroyed
			and teleporting
			and selectedPlayer == player then

			EquipFists()
		end
	end)

	teleportConnection =
		RunService.Heartbeat:Connect(function()

			if destroyed then
				return
			end

			if not teleporting then
				return
			end

			if not selectedPlayer then

				StopTeleport()

				return
			end

			if not selectedPlayer.Parent then

				StopTeleport()

				return
			end

			if E.atmPaused and E.atmPaused() then return end
            if E.canFollow and not E.canFollow(selectedPlayer) then return end

			local character =
				LocalPlayer.Character

			local targetCharacter =
				selectedPlayer.Character

			if not character
				or not targetCharacter then

				return
			end

			local myHumanoid =
				character:FindFirstChildOfClass(
					"Humanoid"
				)

			local myRoot =
				character:FindFirstChild(
					"HumanoidRootPart"
				)

			local targetHumanoid =
				targetCharacter:FindFirstChildOfClass(
					"Humanoid"
				)

			local targetRoot =
				targetCharacter:FindFirstChild(
					"HumanoidRootPart"
				)

			if not myHumanoid
				or not myRoot
				or not targetHumanoid
				or not targetRoot then

				return
			end

			if myHumanoid.Health <= 0 then
				return
			end

			if targetHumanoid.Health <= 0 then
				return
			end

			local currentTime =
				tick()

			if currentTime - lastTeleport
				>= TP_INTERVAL then

				lastTeleport =
					currentTime

				myRoot.CFrame =
					targetRoot.CFrame
					* CFrame.new(
						0,
						0,
						-TP_DISTANCE
					)
			end
		end)
end

local function RefreshPlayers() end

refreshConnection =
	task.spawn(function()

		while not destroyed do

			RefreshPlayers()

			task.wait(
				PLAYER_REFRESH
			)
		end
	end)

Players.PlayerAdded:Connect(function()

	if not destroyed then
		RefreshPlayers()
	end
end)

Players.PlayerRemoving:Connect(
	function(player)

		if player == selectedPlayer then
			StopTeleport()
		end

		if not destroyed then
			RefreshPlayers()
		end
	end
)

local function SetMinimized(state)
    if destroyed then return end
    minimized=state
    if Body then Body.Visible=not state end
    Main.Size=UDim2.fromOffset(620,state and 55 or 700)
    MinimizeButton.Text=state and "+" or "-"
end

MinimizeButton.MouseButton1Click:Connect(
	function()

		SetMinimized(
			not minimized
		)
	end
)

UserInputService.InputBegan:Connect(
	function(input, processed)

		if processed or destroyed then
			return
		end

		if input.KeyCode ==
			Enum.KeyCode.LeftAlt
			or input.KeyCode ==
			Enum.KeyCode.RightAlt then

			SetMinimized(
				not minimized
			)
		end
	end
)

DeleteButton.MouseButton1Click:Connect(
	function()

		if destroyed then
			return
		end

		destroyed = true

		teleporting = false
		selectedPlayer = nil

		AutoTP_Enabled = false
		AutoTP_Token += 1
		AutoTP_Thread = nil

		AutoSafeEnabled = false
		AutoSafeToken += 1
		AutoSafeThread = nil

		FistsEquipToken += 1
		FistsReequipToken += 1

		FistsEquipBusy = false
		FistsReequipBusy = false

		MeleeFistsEquipToken += 1
		MeleeFistsEquipBusy = false

		AutoRespawnBusy = false

		InfStamina_Disable()
		MeleeAura_Disable()
		FistsReset_Disable()

		if BountyConnection then

			BountyConnection:Disconnect()

			BountyConnection = nil
		end

		if AutoRespawnConnection then

			AutoRespawnConnection:Disconnect()

			AutoRespawnConnection = nil
		end

		if FistsEquipMonitor then

			FistsEquipMonitor:Disconnect()

			FistsEquipMonitor = nil
		end

		if FistsForceFieldConnection then

			FistsForceFieldConnection:Disconnect()

			FistsForceFieldConnection = nil
		end

		if MeleeFistsEquipConnection then

			MeleeFistsEquipConnection:Disconnect()

			MeleeFistsEquipConnection = nil
		end

		if teleportConnection then

			teleportConnection:Disconnect()

			teleportConnection = nil
		end

		if refreshConnection then

			task.cancel(
				refreshConnection
			)

			refreshConnection = nil
		end

		ScreenGui:Destroy()
	end
)

;(function()
    local dragInput,dragOrigin,startPos
    local dragging=false
    local began=TopBar.InputBegan:Connect(function(input)
        if destroyed then return end
        if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
            dragging=true; dragInput=input; dragOrigin=input.Position; startPos=Main.Position
        end
    end)
    local ended=UserInputService.InputEnded:Connect(function(input)
        if input==dragInput or input.UserInputType==Enum.UserInputType.MouseButton1 then dragging=false end
    end)
    local changed=UserInputService.InputChanged:Connect(function(input)
        if destroyed or not dragging then return end
        if input.UserInputType~=Enum.UserInputType.MouseMovement and input~=dragInput then return end
        local delta=input.Position-dragOrigin
        Main.Position=UDim2.new(startPos.X.Scale,startPos.X.Offset+delta.X,startPos.Y.Scale,startPos.Y.Offset+delta.Y)
    end)
    ScreenGui.Destroying:Connect(function() began:Disconnect(); ended:Disconnect(); changed:Disconnect() end)
end)()

;(function()
    local Http = game:GetService("HttpService")
    local token = Http:GenerateGUID(false)
    local prefix = "HW_Team_v4_" .. game.PlaceId .. "_" .. game.JobId:gsub("[^%w%-]", "")
    local capable = type(writefile) == "function" and type(readfile) == "function"
    local chosen, currentCommand, applied = nil, nil, nil
    local pausedCommand, roleStatus = nil, "Waiting for hunter"
    local peers, rows = {}, {}
    local selectionMode = nil
    local teamPaused, pauseConfig = false, nil
    local state, lastRole = nil, nil
    local lastCharacter, lifeToken = nil, ""
    local THRESHOLD = 10000
    local initialManagerBank = nil
    local managerBankStartedAt = nil
    local function parseBounty(raw)
        if type(raw) ~= "string" then return nil end
        local clean=raw:lower():gsub("<[^>]*>", ""):gsub("%s", ""):gsub("%$", "")
        local number,suffix=clean:match("([%d%.,]+)([km])")
        if number then
            if number:find(",",1,true) and not number:find(".",1,true) then number=number:gsub(",", ".") end
            local n=tonumber(number)
            return n and n*(suffix=="k" and 1000 or 1000000) or nil
        end
        number=clean:match("[%d%.,]+")
        if not number then return nil end
        local integer=number:match("^%d+[,.]%d%d%d$") or number:match("^%d+[,.]%d%d%d[,.]%d%d%d$")
        if integer then number=number:gsub("[,.]", "")
        elseif number:find(",",1,true) and number:find(".",1,true) then
            if number:match(",%d%d?$") then number=number:gsub("%.", ""):gsub(",", ".")
            else number=number:gsub(",", "") end
        else number=number:gsub(",", ".") end
        return tonumber(number)
    end
    local function getLocalBank()
        local obj=LocalPlayer:FindFirstChild("PlayerGui")
        for _,name in ipairs({"CoreGUI","StatsFrame","Frame2","Frame","Container","Bank","Amt"}) do
            obj=obj and obj:FindFirstChild(name)
        end
        if not obj or not (obj:IsA("TextLabel") or obj:IsA("TextButton") or obj:IsA("TextBox")) then return nil end
        if obj.Text:find("-",1,true) then return nil end
        local amount=parseBounty(obj.Text)
        if type(amount)~="number" or amount~=amount or amount<0 or amount==math.huge then return nil end
        return amount
    end
    local function formatEarned(amount)
        local number=string.format("%.0f",amount)
        local formatted=number:reverse():gsub("(%d%d%d)","%1,"):reverse():gsub("^,", "")
        return "+$" .. formatted
    end
    SharedBountyReached=function()
        local label=GetOriginalBountyLabel()
        local n=label and parseBounty(label.Text)
        return n~=nil and n>=THRESHOLD
    end
    local ioStatus = ""
    local selectionStatus = "Click a role selector, then an account."
    local followStatus=""
    local function timeNow() return DateTime.now().UnixTimestampMillis / 1000 end
    local function file(id) return prefix .. "_" .. tostring(id) .. ".json" end
    local function read(name)
        local ok, result = pcall(function()
            -- Read directly: isfile may lag behind newly written peer files.
            return Http:JSONDecode(readfile(name))
        end)
        return ok and type(result) == "table" and result or nil
    end
    local function write(name, data)
        local ok = pcall(function() writefile(name, Http:JSONEncode(data)) end)
        if not ok then ioStatus="Could not write to workspace." end
        return ok
    end
    local farmClock=nil
    local function validClock(record)
        if type(record)~="table" or type(record.elapsed)~="number" or record.elapsed~=record.elapsed
            or record.elapsed<0 or record.elapsed==math.huge or type(record.updated)~="number"
            or record.updated~=record.updated or type(record.running)~="boolean" then return false end
        local owner=peers[record.issuer]
        return owner~=nil and owner.token==record.token
    end
    local function updateFarmClock()
        local sharedClock=read(file("farm_clock"))
        if validClock(sharedClock) then farmClock=sharedClock
        elseif not validClock(farmClock) then farmClock=nil end
        if currentCommand and currentCommand.issuer==LocalPlayer.UserId and currentCommand.token==token then
            local now=timeNow()
            local elapsed=farmClock and farmClock.elapsed or 0
            if farmClock and farmClock.running and farmClock.command==currentCommand.id then
                elapsed+=math.clamp(now-farmClock.updated,0,2)
            end
            farmClock={issuer=LocalPlayer.UserId,token=token,command=currentCommand.id,
                elapsed=elapsed,updated=now,running=currentCommand.hunter~=0 and not teamPaused and not (E.atmHunterAway and E.atmHunterAway())}
            write(file("farm_clock"),farmClock)
        end
        if FarmTimerLabel then
            local total=math.floor(farmClock and farmClock.elapsed or 0)
            FarmTimerLabel.Text=string.format("%02d:%02d:%02d",math.floor(total/3600),math.floor(total/60)%60,total%60)
        end
    end

    local voidConfig = nil
    local voidPlatform = nil
    local voidButton = nil
    local voidStatus = ""
    local lastVoidAttempt = -math.huge
    local VOID_MARGIN = 80
    local VOID_INTERVAL = 1
    local function finite(n)
        return type(n)=="number" and n==n and math.abs(n)<1000000
    end
    local function validVoid(config)
        if type(config)~="table" or config.version~=1 or type(config.enabled)~="boolean" then return false end
        local owner=peers[config.issuer]
        if not owner or owner.token~=config.token then return false end
        return finite(config.x) and finite(config.z) and math.abs(config.x)<=45000 and math.abs(config.z)<=45000
    end
    local function voidHeight()
        local height=workspace.FallenPartsDestroyHeight
        if not finite(height) or height>49000 then return nil end
        return height+VOID_MARGIN
    end
    local function ensureVoidPlatform()
        if not voidConfig or not voidConfig.enabled then return false end
        local height=voidHeight()
        if not height then voidStatus="Invalid fall limit; void TP stopped" return false end
        if not voidPlatform or not voidPlatform.Parent then
            voidPlatform=Instance.new("Part")
            voidPlatform.Name="HW_VoidPlatform_" .. LocalPlayer.UserId
            voidPlatform.Anchored=true
            voidPlatform.Size=Vector3.new(120,8,120)
            voidPlatform.CanCollide=true
            voidPlatform.CanTouch=false
            voidPlatform.CanQuery=false
            voidPlatform.Material=Enum.Material.Metal
            voidPlatform.Color=Color3.fromRGB(40,65,80)
            voidPlatform.TopSurface=Enum.SurfaceType.Smooth
            voidPlatform.BottomSurface=Enum.SurfaceType.Smooth
            voidPlatform.Parent=workspace
        end
        if voidPlatform.Position.X~=voidConfig.x or voidPlatform.Position.Z~=voidConfig.z then
            E.retainedPlatforms=E.retainedPlatforms or {}
            if #E.retainedPlatforms<2 then
                local retained=voidPlatform:Clone()
                retained.Parent=workspace
                table.insert(E.retainedPlatforms,retained)
            end
        end
        voidPlatform.CFrame=CFrame.new(voidConfig.x,height,voidConfig.z)
        return true
    end
    local function syncVoid()
        local config=read(file("void_settings"))
        if validVoid(config) then
            if not voidConfig or voidConfig.id~=config.id then lastVoidAttempt=-math.huge end
            voidConfig=config
        elseif not validVoid(voidConfig) then
            voidConfig=nil
        end
        if voidConfig and voidConfig.enabled then ensureVoidPlatform() end
    end
    local function toggleVoid()
        if not capable then ioStatus="Void mode requires shared Potassium files." return end
        local enable=not (voidConfig and voidConfig.enabled)
        local height=voidHeight()
        if enable and not height then ioStatus="Could not read a valid fall limit." return end
        local root=LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
        local origin=root and root.Position or AUTO_SAFE_POSITION
        local config={version=1,id=Http:GenerateGUID(false),issuer=LocalPlayer.UserId,token=token,
            enabled=enable,x=voidConfig and voidConfig.x or math.clamp(origin.X+700,-45000,45000),
            z=voidConfig and voidConfig.z or math.clamp(origin.Z+700,-45000,45000)}
        if write(file("void_settings"),config) then
            voidConfig=config
            lastVoidAttempt=-math.huge
            ioStatus=""
            selectionStatus=enable and "Void enabled for the team; select a hunter if none is assigned." or "Void disabled: fixed TP stopped; platform retained to prevent falling."
            if enable then ensureVoidPlatform() end
        end
    end
    local function tickVoid()
        local enabled=voidConfig and voidConfig.enabled
        if voidButton then
            voidButton.Text=enabled and "FARM IN THE VOID: ON" or "FARM IN THE VOID: OFF"
            voidButton.BackgroundColor3=enabled and Color3.fromRGB(35,125,115) or Color3.fromRGB(42,49,70)
        end
        if not enabled then voidStatus="" return end
        if state and (state.phase=="give" or state.phase=="give_prepare") then voidStatus="Void TP suspended for bounty delivery" return end
        if E.atmPaused and E.atmPaused() then voidStatus="Void TP paused for allowance trip" return end
        if teamPaused then voidStatus="Void TP paused with the team" return end
        if not ensureVoidPlatform() then return end
        if not currentCommand or currentCommand.hunter==0 then
            voidStatus="Void ready; waiting for hunter"
            return
        end
        if currentCommand.hunter~=LocalPlayer.UserId then
            voidStatus="Local platform ready; following hunter"
            return
        end
        if pausedCommand==currentCommand.id then voidStatus="Void TP paused on this account" return end
        if os.clock()-lastVoidAttempt<VOID_INTERVAL then return end
        lastVoidAttempt=os.clock()
        local character=LocalPlayer.Character
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        local root=character and character:FindFirstChild("HumanoidRootPart")
        if not hum or hum.Health<=0 or not root then
            voidStatus="Void: waiting for hunter respawn"
            return
        end
        
        local clearance=math.max(6,hum.HipHeight+root.Size.Y/2+1)
        local position=voidPlatform.Position+Vector3.new(0,voidPlatform.Size.Y/2+clearance,0)
        local delta=root.Position-position
        if Vector2.new(delta.X,delta.Z).Magnitude>2 or math.abs(delta.Y)>8 then
            root.CFrame=CFrame.new(position)
            root.AssemblyLinearVelocity=Vector3.zero
            root.AssemblyAngularVelocity=Vector3.zero
            voidStatus="Hunter moved to void; checking every 1 s"
        else
            voidStatus="Hunter on platform; checking every 1 s"
        end
    end
    ScreenGui.Destroying:Connect(function()
        if voidPlatform then voidPlatform:Destroy(); voidPlatform=nil end
        for _,platform in ipairs(E.retainedPlatforms or {}) do platform:Destroy() end
    end)

    local function make(class, props, parent)
        local obj = Instance.new(class)
        for k,v in pairs(props) do obj[k] = v end
        obj.Parent = parent
        return obj
    end
    local function text(parent, y, h, size)
        return make("TextLabel", {Position=UDim2.fromOffset(16,y), Size=UDim2.new(1,-32,0,h),
            BackgroundTransparency=1, Text="", TextWrapped=true, TextSize=size or 14,
            Font=Enum.Font.GothamMedium, TextColor3=Color3.fromRGB(220,226,240), TextXAlignment=Enum.TextXAlignment.Left},parent)
    end
    local function style(button, y, label)
        button.Parent = Body
        button.Position = UDim2.fromOffset(16,y)
        button.Size = UDim2.new(1,-32,0,40)
        button.Text = label or button.Text
        button.TextSize = 13
        button.TextWrapped = true
        button.BackgroundColor3 = Color3.fromRGB(42,49,70)
    end
    Title.Text = "AUTOFARM"
    Title.TextSize = 19
    Main.Size = UDim2.fromOffset(620,700)
    Main.Position = UDim2.new(0.5,-310,0.5,-350)
    local scale = make("UIScale",{},Main)
    local function fit()
        local camera = workspace.CurrentCamera
        if camera then scale.Scale = math.min(1, (camera.ViewportSize.X-20)/620, (camera.ViewportSize.Y-20)/700) end
    end
    fit()
    Body = make("ScrollingFrame", {Name="UnifiedBody",Position=UDim2.fromOffset(0,55),
        Size=UDim2.new(1,0,1,-55),CanvasSize=UDim2.fromOffset(0,955),
        BackgroundTransparency=1,BorderSizePixel=0,ScrollBarThickness=5},Main)
    Subtitle.Parent=Body
    Subtitle.Position=UDim2.fromOffset(16,4)
    Subtitle.Size=UDim2.new(1,-32,0,35)
    Subtitle.Text="Accounts on this PC · same workspace and server"
    Subtitle.TextSize=12
    Subtitle.TextWrapped=true
    BountyFrame.Parent=Body
    BountyFrame.Position=UDim2.fromOffset(16,42)
    BountyFrame.Size=UDim2.new(1,-32,0,48)
    BountyTitle.Text="MY BOUNTY"
    SelectedLabel.Parent=Body
    SelectedLabel.Position=UDim2.fromOffset(16,96)
    SelectedLabel.Size=UDim2.new(1,-32,0,35)
    SelectedLabel.TextWrapped=true
    SelectedLabel.TextSize=13
    local teamStatus=text(Body,135,48,13)
    local targetInfo=text(Body,186,52,15)
    local bountyInfo=text(Body,242,48,20)
    bountyInfo.TextColor3=Color3.fromRGB(100,230,170)
    local selectHunter=make("TextButton",{Font=Enum.Font.GothamBold,TextColor3=Color3.new(1,1,1)},Body)
    style(selectHunter,298,"SELECT HUNTER: choose an account below")
    local stopTeam=make("TextButton",{Font=Enum.Font.GothamBold,TextColor3=Color3.new(1,1,1)},Body)
    style(stopTeam,390,"PAUSE TEAM")
    stopTeam.BackgroundColor3=Color3.fromRGB(140,55,70)
    local managerButton=make("TextButton",{Font=Enum.Font.GothamBold,TextColor3=Color3.new(1,1,1)},Body)
    style(managerButton,344,"SELECT MANAGER")
    managerButton.BackgroundColor3=Color3.fromRGB(95,65,135)
    voidButton=make("TextButton",{Font=Enum.Font.GothamBold,TextColor3=Color3.new(1,1,1)},Body)
    style(voidButton,436,"FARM IN THE VOID: OFF")
    voidButton.Activated:Connect(toggleVoid)
    PlayerList.Parent=Body
    PlayerList.Position=UDim2.fromOffset(16,494)
    PlayerList.Size=UDim2.new(1,-32,0,170)
    Layout.SortOrder=Enum.SortOrder.LayoutOrder
    style(StaminaButton,678)
    style(MeleeButton,724)
    style(AutoTPButton,770)
    style(AutoSafeButton,816)
    style(StopButton,862,"PAUSE TP")
    local note=text(Body,905,40,11)
    note.Text="Choose a role with its button, then click an account. Both roles are shared with the team."

    local function stopRole()
        E.giftDamage=false; E.giftMoved=nil
        SharedAttackTargets={}; SharedFinishing=false; SharedHunterRespawn=false; SharedStopAtCap=false
        StopTeleport()
        MeleeAura_Disable()
        UpdateMeleeButton()
    end
    local function issue(hunterId, managerId)
        if not capable then ioStatus="Potassium file functions are missing." return end
        if hunterId and hunterId~=0 and not peers[hunterId] then ioStatus="The hunter is not sharing data." return end
        managerId=managerId or (currentCommand and currentCommand.manager) or 0
        if hunterId and hunterId==managerId then ioStatus="Hunter and manager must be different accounts." return end
        if hunterId and managerId~=0 and not peers[managerId] then ioStatus="The manager is not connected." return end
        local command={version=2,issuer=LocalPlayer.UserId,token=token,id=Http:GenerateGUID(false),hunter=hunterId or 0,manager=managerId}
        if write(file("command"),command) then
            currentCommand=command
            applied=nil
            state=nil
            pausedCommand=nil
            local hp=Players:GetPlayerByUserId(command.hunter)
            local mp=Players:GetPlayerByUserId(command.manager)
            selectionStatus="Saved: hunter " .. (hp and hp.Name or "unassigned") .. " / manager " .. (mp and mp.Name or "unassigned")
            ioStatus=""
            return true
        end
        return false
    end
    managerButton.Activated:Connect(function()
        selectionMode="manager"
        selectionStatus="Choose the MANAGER in the account list."
        Body.CanvasPosition=Vector2.new(0,160)
        managerButton.Text="SELECT MANAGER: click an account below"
        selectHunter.Text="SELECT HUNTER"
    end)
    selectHunter.Activated:Connect(function()
        selectionMode="hunter"
        selectionStatus="Choose the HUNTER in the account list."
        Body.CanvasPosition=Vector2.new(0,160)
        selectHunter.Text="SELECT HUNTER: click an account below"
        managerButton.Text="SELECT MANAGER"
    end)
    stopTeam.Activated:Connect(function()
        if not currentCommand or currentCommand.hunter==0 then ioStatus="Select a hunter first." return end
        local config={command=currentCommand.id,issuer=LocalPlayer.UserId,token=token,paused=not teamPaused}
        if write(file("team_pause"),config) then
            pauseConfig=config; teamPaused=config.paused
            if teamPaused then stopRole() end
            stopTeam.Text=teamPaused and "RESUME TEAM" or "PAUSE TEAM"
            selectionStatus=teamPaused and "Team paused. Hunter and manager are preserved." or "Team resumed."
        end
    end)
    StopButton.Activated:Connect(function()
        if not currentCommand or currentCommand.hunter==0 then ioStatus="Select a hunter first." return end
        if pausedCommand==currentCommand.id then
            pausedCommand=nil
            selectionStatus="This account will resume its assigned role."
        else
            pausedCommand=currentCommand.id
            stopRole()
            selectionStatus="This account is paused. Click RESUME TP to continue."
        end
        StopButton.Text=pausedCommand==currentCommand.id and "RESUME TP" or "PAUSE TP"
    end)
    -- Cross-account options use the same authenticated session records as roles.
    E.options={recipient=0,mode="off",requestId="",safe=false,meleeInterval=MELEE_INTERVAL}
    function E.setMeleeInterval(value)
        if type(value)~="number" or value~=value or value<0.05 or value>2 then return false end
        MELEE_INTERVAL=math.floor(value/0.05+0.5)*0.05
        E.options.meleeInterval=MELEE_INTERVAL
        return true
    end
    E.status="Select a recipient. Damage attribution is unavailable; any damage resets the hunter during delivery."
    E.snapshot={}
    E.safeSince=nil
    E.receivedOnce=""
    E.audit={count=0,pending={},last=nil}
    function E.change(patch)
        if not capable then E.status="Shared file access is unavailable." return false end
        local nextOptions={version=1,issuer=LocalPlayer.UserId,token=token,id=Http:GenerateGUID(false)}
        for _,key in ipairs({"recipient","mode","requestId","safe","webhook","meleeInterval"}) do nextOptions[key]=E.options[key] end
        for key,value in pairs(patch) do nextOptions[key]=value end
        if write(file("extra_options"),nextOptions) then
            E.options=nextOptions
            if nextOptions.meleeInterval then E.setMeleeInterval(nextOptions.meleeInterval) end
            if patch.mode=="off" then E.giftDamage=false end
            E.status="Team options updated."
            return true
        end
        return false
    end
    function E.sync()
        local value=read(file("extra_options"))
        local owner=value and peers[value.issuer]
        if owner and owner.token==value.token and value.version==1
            and type(value.recipient)=="number" and type(value.safe)=="boolean"
            and type(value.requestId)=="string"
            and (value.mode=="off" or value.mode=="manual" or value.mode=="auto") then
            E.options=value
            if not E.meleeDragging and value.meleeInterval then E.setMeleeInterval(value.meleeInterval) end
            if E.acceptSharedHook then E.acceptSharedHook(value.webhook) end
        end
    end
    function E.selectRecipient(id)
        if currentCommand and id==currentCommand.hunter then E.status="The hunter cannot receive its own bounty." return end
        E.change({recipient=id,mode="off",requestId=""})
    end
    function E.give(mode)
        if mode~="off" then
            if not currentCommand or currentCommand.hunter==0 then E.status="Select a hunter first." return end
            if not Players:GetPlayerByUserId(E.options.recipient) or E.options.recipient==currentCommand.hunter then
                E.status="Select another player who is still in this server." return
            end
        end
        E.change({mode=mode,requestId=Http:GenerateGUID(false)})
    end
    function E.wantsGift()
        return E.options.recipient~=0 and currentCommand and E.options.recipient~=currentCommand.hunter
            and Players:GetPlayerByUserId(E.options.recipient)~=nil
            and (E.options.mode=="auto" or (E.options.mode=="manual" and E.options.requestId~=E.receivedOnce))
    end
    function E.safeReady()
        if not (E.options.safe and voidConfig and voidConfig.enabled) then E.safeSince=nil return true end
        local character=LocalPlayer.Character
        local root=character and character:FindFirstChild("HumanoidRootPart")
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        local height=voidHeight()
        local positioned=root and hum and hum.Health>0 and height
            and math.abs(root.Position.X-voidConfig.x)<4 and math.abs(root.Position.Z-voidConfig.z)<4
            and root.Position.Y>height+4 and root.Position.Y<height+25
        if not positioned or E.safeLife~=character then E.safeSince=nil end
        E.safeLife=character
        if not positioned then return false end
        E.safeSince=E.safeSince or os.clock()
        return os.clock()-E.safeSince>=5
    end
    function E.deliveryReady(command,h)
        if not h or h.command~=command.id or h.phase~="give_prepare" then return false end
        -- Wait for every live participant to acknowledge that its attack loop is off.
        for id,peer in pairs(peers) do
            if id~=command.hunter and (peer.command~=command.id or peer.phase~="give_prepare" or peer.attacking==true) then return false end
        end
        return true
    end
    function E.advanceGift(command,h,bounty)
        if E.options.mode=="manual" and state.giftConsumed==E.options.requestId then E.receivedOnce=state.giftConsumed end
        local wants=E.wantsGift()
        if state.phase=="give_prepare" or state.phase=="give" then
            local dead=h and ((type(h.health)=="number" and h.health<=0) or h.life~=state.life)
            -- A respawn can temporarily display zero before the real bounty arrives.
            local zeroConfirmed=false
            if bounty==0 and h and type(h.health)=="number" and h.health>0 and not dead
                and type(h.updated)=="number" and timeNow()-h.updated>=0 and timeNow()-h.updated<=1.5 then
                if state.zeroLife~=h.life or not state.zeroLast or timeNow()-state.zeroLast>1.5 then
                    state.zeroSince=timeNow(); state.zeroSamples=0; state.zeroSample=nil
                end
                state.zeroLife=h.life; state.zeroLast=timeNow()
                if state.zeroSample~=h.updated then
                    state.zeroSamples=(state.zeroSamples or 0)+1; state.zeroSample=h.updated
                end
                zeroConfirmed=timeNow()-(state.zeroSince or timeNow())>=5 and (state.zeroSamples or 0)>=6
            else
                state.zeroSince=nil; state.zeroLife=nil; state.zeroLast=nil; state.zeroSamples=0; state.zeroSample=nil
            end
            if zeroConfirmed then
                state.phase="respawn"
                state.giftConsumed=state.giftRequest
                E.receivedOnce=state.giftRequest
                return true
            end
            if not wants or state.recipient~=E.options.recipient or state.giftRequest~=E.options.requestId then
                state.phase=bounty and bounty>=THRESHOLD and "prepare" or "farm"
                -- Keep delivery exemption for this life: an already landed hit can settle later.
                E.status="Delivery canceled; returning to normal farming."
                return true
            end
            if not h or dead then
                state.phase="give_prepare"
                if h and type(h.health)=="number" and h.health>0 then state.life=h.life end
                E.status="Delivery still pending: waiting for the hunter to respawn."
                return true
            end
            if state.phase=="give_prepare" and E.deliveryReady(command,h) then state.phase="give" end
            return true
        end
        if wants and bounty and bounty>=THRESHOLD and state.phase~="respawn" then
            state.phase="give_prepare"; state.life=h.life
            state.recipient=E.options.recipient; state.giftRequest=E.options.requestId; state.giftExempt=true
            state.giftMode=E.options.mode
            return true
        end
        return false
    end
    function E.applyGift(role)
        E.giftDamage=false
        if role~="gift" then E.giftMoved=nil return end
        local recipient=state and Players:GetPlayerByUserId(state.recipient or 0)
        local target=recipient and recipient.Character
        local root=target and target:FindFirstChild("HumanoidRootPart")
        local targetHum=target and target:FindFirstChildOfClass("Humanoid")
        local character=LocalPlayer.Character
        local ownRoot=character and character:FindFirstChild("HumanoidRootPart")
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        if state and state.zeroSince then
            if FistsReset_Enabled then FistsReset_Disable() end
            E.status="Confirming zero bounty for 5 seconds; manager remains paused."
            return
        end
        if not root or not targetHum or targetHum.Health<=0 or not ownRoot or not hum or hum.Health<=0 then
            if FistsReset_Enabled then FistsReset_Disable() end
            E.status="Delivery waiting for both characters to be alive."
            return
        end
        local key=tostring(state.giftRequest)..":"..tostring(state.round)..":"..tostring(character)
        if E.giftMoved~=key or E.giftCharacter~=character or os.clock()-(E.lastGiftTP or 0)>=1 then
            ownRoot.CFrame=root.CFrame*CFrame.new(0,0,-TP_DISTANCE)
            ownRoot.AssemblyLinearVelocity=Vector3.zero
            ownRoot.AssemblyAngularVelocity=Vector3.zero
            E.giftMoved=key
            E.giftCharacter=character
            E.lastGiftTP=os.clock()
        end
        E.giftDamage=true
        if not E.giftFistsBusy and os.clock()-(E.lastGiftFists or -math.huge)>=1 then
            E.giftFistsBusy=true; E.lastGiftFists=os.clock()
            task.spawn(function()
                local ok=pcall(function()
                    if destroyed or not E.giftDamage or LocalPlayer.Character~=character then return end
                    EquipFists(character)
                    if destroyed or not E.giftDamage or LocalPlayer.Character~=character then return end
                    ForceReequipFists(character)
                end)
                E.giftFistsBusy=false
                if not ok then
                    FistsEquipBusy=false; FistsReequipBusy=false
                    E.status="Could not equip fists; retrying during delivery."
                end
            end)
        end
        if not FistsReset_Enabled then FistsReset_Enable() end
        E.status="Delivery to @"..recipient.Name..": waiting for damage. Manager attacks are paused."
    end
    function E.monitorDamage() end
    function E.theftInterval(audit)
        local total=0
        for _,sample in ipairs(audit.payoutSamples or {}) do total+=sample end
        local count=#(audit.payoutSamples or {})
        return count>0 and math.clamp(total/count,10,3600) or 60
    end
    function E.flagTheft(audit,now,message)
        audit.count+=1
        audit.lastAlert=now
        audit.message=message
    end
    function E.damageIncidents(audit,command,m,validBank,now)
        if validBank then
            if audit.payoutToken~=m.token then
                audit.payoutToken=m.token; audit.payoutStart=now; audit.payoutBank=m.bank
            end
            if m.bank<(audit.payoutBank or m.bank) then audit.payoutStart=now; audit.payoutBank=m.bank end
            if state.giftExempt then audit.payoutStart=now; audit.payoutBank=m.bank
            elseif m.bank-(audit.payoutBank or m.bank)>=9000 then
                -- Include near-10k payouts (for example 9,985), rather than requiring exact equality.
                local duration=now-(audit.payoutStart or now)
                if duration>=1 then
                    audit.payoutSamples=audit.payoutSamples or {}
                    table.insert(audit.payoutSamples,duration)
                    if #audit.payoutSamples>10 then table.remove(audit.payoutSamples,1) end
                end
                audit.payoutStart=now; audit.payoutBank=m.bank
            end
        end
    end
    function E.observeHunterVoid(hunter)
        if not (E.options.safe and voidConfig and voidConfig.enabled) then
            E.observation=nil; E.observedVoidPositioned=nil
            return true
        end
        local character=hunter and hunter.Character
        local root=character and character:FindFirstChild("HumanoidRootPart")
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        local height=voidHeight()
        local positioned=root and hum and hum.Health>0 and height
            and math.abs(root.Position.X-voidConfig.x)<4 and math.abs(root.Position.Z-voidConfig.z)<4
            and root.Position.Y>height+4 and root.Position.Y<height+25
        E.observedVoidPositioned=positioned and true or false
        local observation=E.observation
        if not observation or observation.character~=character or observation.hunter~=hunter
            or observation.voidId~=voidConfig.id then
            observation={character=character,hunter=hunter,voidId=voidConfig.id}
            E.observation=observation
        end
        if not positioned then observation.since=nil; return false end
        observation.since=observation.since or os.clock()
        return os.clock()-observation.since>=5
    end
    function E.canFollow(hunter)
        return E.observeHunterVoid(hunter)
    end
    function E.remoteVoidReady(command)
        if not (E.options.safe and voidConfig and voidConfig.enabled) then return true end
        local count=0
        for id,peer in pairs(peers) do
            if id~=command.hunter then
                count+=1
                if peer.observedHunter~=command.hunter or peer.observedVoidId~=voidConfig.id
                    or peer.observedCommand~=command.id or peer.observedVoidReady~=true
                    or type(peer.updated)~="number" or timeNow()-peer.updated>1.5 then return false end
            end
        end
        return count>0
    end
    function E.managerFistsReady(character)
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        if not hum or hum.Health<=0 then return false end
        local equipped=character:FindFirstChild("Fists")
        if equipped and equipped:IsA("Tool") then return true end
        if E.managerEquipCharacter==character and os.clock()-(E.managerEquipAt or 0)<0.5 then return false end
        E.managerEquipCharacter=character; E.managerEquipAt=os.clock()
        local backpack=LocalPlayer:FindFirstChildOfClass("Backpack")
        local fists=backpack and backpack:FindFirstChild("Fists")
        if not fists or not fists:IsA("Tool") then return false end
        -- This retry does not depend on the legacy asynchronous busy flags.
        local ok=pcall(function() hum:EquipTool(fists) end)
        return ok and character:FindFirstChild("Fists")==fists
    end
    function E.targetVoidReady(id,command)
        if peers[id] and (peers[id].atmTripActive or peers[id].manualPaused) then return false end
        if not (E.options.safe and voidConfig and voidConfig.enabled) then return true end
        local peer=peers[id]
        return peer~=nil and peer.observedHunter==command.hunter and peer.observedCommand==command.id
            and peer.observedVoidId==voidConfig.id and peer.observedVoidReady==true
            and type(peer.updated)=="number" and timeNow()-peer.updated>=0 and timeNow()-peer.updated<=1.5
    end
    function E.trackMoney(command,h,m,bounty)
        if not command or command.issuer~=LocalPlayer.UserId or not state then return end
        local now=timeNow()
        local audit=E.audit
        if audit.version~=3 then
            audit={version=3,count=0,total=0,victims={},deaths={},credits={},confirmed=0}
            E.audit=audit
        end
        if audit.command~=command.id or audit.manager~=command.manager or audit.hunter~=command.hunter then
            audit.command=command.id; audit.manager=command.manager; audit.hunter=command.hunter
            audit.last=nil; audit.victims={}; audit.deaths={}; audit.credits={}; audit.confirmed=0; audit.loss=nil; audit.peak=0
            audit.bank=nil; audit.managerToken=nil; audit.paid=false; audit.exempt=false
            audit.damageSeen={}; audit.suspectUntil=nil; audit.lastAlert=nil
            audit.payoutStart=nil; audit.payoutBank=nil; audit.payoutToken=nil
        end
        local validBank=m and type(m.updated)=="number" and now-m.updated>=0 and now-m.updated<=1.5 and m.bankAvailable==true and type(m.bank)=="number" and m.bank==m.bank and m.bank>=0
        if (h and h.atmTripActive) or (m and m.atmTripActive) then
            audit.atmSuspended=true
            return
        end
        if audit.atmSuspended then
            audit.atmSuspended=nil; audit.bank=validBank and m.bank or nil; audit.paid=false
            audit.last=nil; audit.peak=bounty or 0; audit.loss=nil
            audit.deaths={}; audit.credits={}; audit.victims={}; audit.confirmed=0
        end
        E.damageIncidents(audit,command,m,validBank,now)
        if audit.managerToken and m and m.token~=audit.managerToken then
            audit.confirmed=0; audit.loss=nil; audit.bank=nil; audit.paid=false; audit.deaths={}; audit.credits={}
        end
        if m then audit.managerToken=m.token end
        if audit.bank==nil and validBank then audit.bank=m.bank end
        if validBank and audit.bank and m.bank>audit.bank then audit.paid=true end
        local previous=audit.last
        local fresh=h and type(h.updated)=="number" and now-h.updated>=0 and now-h.updated<=1.5
        local farming=state.phase=="farm" and not teamPaused and not audit.loss
        if farming then
            for id,peer in pairs(peers) do
                if id~=command.hunter then
                    local old=audit.victims[id]
                    local peerFresh=type(peer.updated)=="number" and now-peer.updated>=0 and now-peer.updated<=1.5
                    if old and peerFresh and old.token==peer.token and old.health and old.health>0 and now-old.updated<=3
                        and ((type(peer.health)=="number" and peer.health<=0) or (peer.life and peer.life~=old.life)) then
                        table.insert(audit.deaths,now)
                    end
                    if peerFresh then audit.victims[id]={health=peer.health,life=peer.life,token=peer.token,updated=peer.updated} end
                end
            end
            if fresh and previous and previous.bounty and bounty and bounty>previous.bounty then
                local kills=math.min(100,math.floor((bounty-previous.bounty)/100))
                for _=1,kills do table.insert(audit.credits,now) end
            end
        else audit.victims={} end
        for _,queue in ipairs({audit.deaths,audit.credits}) do
            while #queue>0 and now-queue[1]>3 do table.remove(queue,1) end
        end
        while #audit.deaths>0 and #audit.credits>0 do
            table.remove(audit.deaths,1); table.remove(audit.credits,1); audit.confirmed+=1
        end
        if state.giftExempt then audit.exempt=true end
        if fresh and bounty then
            audit.peak=math.max(audit.peak or 0,bounty)
            if previous and previous.bounty and bounty<previous.bounty
                and previous.bounty>0 and not teamPaused and not audit.loss then
                audit.loss={peak=audit.peak,exempt=audit.exempt,paid=audit.paid,bank=audit.bank,declines=0,started=now,hunterToken=h.token}
            end
            if audit.loss and previous and previous.bounty and bounty<previous.bounty then audit.loss.declines+=1 end
            audit.last={bounty=bounty,updated=h.updated}
        end
        local loss=audit.loss
        if loss then
            local killer=h and h.killerRecord
            if not loss.killer and fresh and h.token==loss.hunterToken and type(killer)=="table"
                and killer.command==command.id and type(killer.at)=="number"
                and killer.at>=loss.started-15 and killer.at<=loss.started+5
                and type(killer.name)=="string" and #killer.name>0 and #killer.name<=160 then
                loss.killer=killer.name; loss.killerUserId=killer.userId
            end
            if fresh and bounty then loss.lowest=math.min(loss.lowest or loss.peak,bounty) end
            loss.amount=math.max(0,loss.peak-(loss.lowest or loss.peak))
            loss.exempt=loss.exempt or audit.exempt
            loss.paid=loss.paid or audit.paid or (validBank and loss.bank and m.bank>loss.bank) or false
            if fresh and bounty==0 and type(h.health)=="number" and h.health>0 then
                if loss.zeroLife~=h.life or not loss.zeroLast or now-loss.zeroLast>1.5 then
                    loss.zeroSince=now; loss.samples=0; loss.sample=nil
                end
                loss.zeroLife=h.life; loss.zeroLast=now
                if loss.sample~=h.updated then loss.samples+=1; loss.sample=h.updated end
                if (now-loss.zeroSince>=5 and loss.samples>=6) or loss.declines>=2 then
                    loss.settledAt=loss.settledAt or now
                end
            elseif not loss.settledAt then
                loss.zeroSince=nil; loss.zeroLast=nil; loss.samples=0; loss.sample=nil
            end
            if loss.settledAt and now-loss.settledAt>=15 then
                if validBank and loss.bank then
                    if not loss.paid and not loss.exempt then
                        E.flagTheft(audit,now,"Hunter bounty reached zero without a detected manager payment.")
                        audit.total+=loss.amount; audit.lastAmount=loss.amount; audit.killer=loss.killer or audit.killer
                        if loss.killer then audit.killerUserId=loss.killerUserId end
                    end
                    audit.loss=nil; audit.confirmed=0; audit.peak=bounty or 0; audit.bank=m.bank
                    audit.paid=false; audit.exempt=false; audit.deaths={}; audit.credits={}
                elseif now-loss.settledAt>45 then
                    audit.loss=nil; audit.confirmed=0; audit.peak=bounty or 0; audit.bank=nil
                    audit.paid=false; audit.exempt=false; audit.deaths={}; audit.credits={}
                end
            end
        elseif fresh and bounty==0 and audit.confirmed==0 then
            audit.peak=0; audit.bank=validBank and m.bank or nil; audit.paid=false; audit.exempt=false
        end
        state.theftCount=audit.count; state.theftMessage=audit.message; state.theftKiller=audit.killer; state.theftKillerUserId=audit.killerUserId
        state.theftAmount=audit.lastAmount or 0; state.theftTotal=audit.total
        state.theftInterval=E.theftInterval(audit)
        state.theftPending=audit.loss~=nil; state.observedFarmKills=audit.confirmed
    end
    function E.recoverVoid()
        local command=currentCommand
        if not E.options.safe or not command or command.hunter~=LocalPlayer.UserId
            or not voidConfig or not voidConfig.enabled or teamPaused or pausedCommand==command.id
            or (E.atmPaused and E.atmPaused()) or not state or state.phase~="farm" then
            E.voidMismatchSince=nil; return
        end
        E.observeHunterVoid(LocalPlayer)
        local character=LocalPlayer.Character
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        if not hum or hum.Health<=0 or E.observedVoidPositioned~=true then E.voidMismatchSince=nil; return end
        if E.voidMismatchHumanoid~=hum then E.voidMismatchHumanoid=hum; E.voidMismatchSince=nil end
        local count=0
        for id,peer in pairs(peers) do
            if id~=command.hunter and not peer.atmTripActive and not peer.manualPaused then
                if type(peer.updated)~="number" or timeNow()-peer.updated<0 or timeNow()-peer.updated>1.5
                    or peer.observedCommand~=command.id or peer.observedHunter~=command.hunter
                    or peer.observedVoidId~=voidConfig.id or peer.observedVoidPositioned~=false then
                    E.voidMismatchSince=nil; return
                end
                count+=1
            end
        end
        if count==0 then E.voidMismatchSince=nil; return end
        E.voidMismatchSince=E.voidMismatchSince or os.clock()
        if os.clock()-E.voidMismatchSince>=3 then
            E.voidMismatchSince=nil
            local oldIgnore=FistsReset_Ignore
            FistsReset_Ignore=true
            local ok=pcall(function() hum.Health=0 end)
            FistsReset_Ignore=oldIgnore
            lastVoidAttempt=-math.huge
            E.observation=nil
            if ok then E.status="Safe farm: position disagreement; restarting hunter and retrying void TP." end
        end
    end
    function E.resetLowHealth(character)
        if E.atmTripActive or E.manualPaused then return end
        local command=currentCommand
        if destroyed or not command or command.hunter==0 or teamPaused or pausedCommand==command.id then return end
        if character~=LocalPlayer.Character then return end
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        if not hum or hum.Health<=0 or hum.MaxHealth<=0 or hum.Health>hum.MaxHealth*0.15 then return end
        if E.lowHealthResetHumanoid==hum and os.clock()-(E.lowHealthResetAt or 0)<1 then return end
        E.lowHealthResetHumanoid=hum; E.lowHealthResetAt=os.clock()
        local previousIgnore=FistsReset_Ignore
        FistsReset_Ignore=true
        local ok=pcall(function() hum.Health=0 end)
        FistsReset_Ignore=previousIgnore
        if not ok then E.lowHealthResetHumanoid=nil end
    end
    function E.identifyKiller(text)
        local exact=nil
        local lower=text:lower()
        for _,player in ipairs(Players:GetPlayers()) do
            if lower==player.Name:lower() or lower==("@"..player.Name:lower()) then return player.UserId end
        end
        for _,player in ipairs(Players:GetPlayers()) do
            if lower==player.DisplayName:lower() then
                if exact then return nil end
                exact=player.UserId
            end
        end
        return exact
    end
    function E.killerPresence(id)
        if type(id)~="number" then return "Identity unverified" end
        return Players:GetPlayerByUserId(id) and "In this server" or "Left this server"
    end
    function E.captureKiller()
        local command=currentCommand
        if not command or command.hunter~=LocalPlayer.UserId or teamPaused or pausedCommand==command.id
            or (state and state.giftExempt) then E.deathCapture=nil; return end
        local character=LocalPlayer.Character
        local hum=character and character:FindFirstChildOfClass("Humanoid")
        local gui=LocalPlayer:FindFirstChild("PlayerGui")
        local death=gui and gui:FindFirstChild("DeathGUI")
        local frame=death and death:FindFirstChild("Frame")
        local inner=frame and frame:FindFirstChild("Frame2")
        local label=inner and inner:FindFirstChild("Killer")
        local text=label and label.Text or ""
        local visible=death and death.Enabled and frame and frame.Visible and inner and inner.Visible and label and label.Visible
        if hum and hum.Health>0 then
            E.deathCapture=nil; E.killerBaseline=text; E.killerWasVisible=visible
            return
        end
        if not hum and not visible then return end
        local capture=E.deathCapture
        if not capture or capture.character~=character or capture.command~=command.id then
            capture={character=character,command=command.id,at=timeNow(),started=os.clock(),life=lifeToken}
            E.deathCapture=capture
        end
        text=text:gsub("<[^>]*>",""):match("^%s*(.-)%s*$")
        local lower=text:lower()
        local valid=text~="" and #text<=160 and lower~="unknown" and lower~="killer" and lower~="loading" and lower~="loading..." and lower~="..."
        if visible and valid and (text~=E.killerBaseline or not E.killerWasVisible) then
            E.killerRecord={command=command.id,life=capture.life,at=capture.at,name=text,userId=E.identifyKiller(text)}
            capture.captured=true; capture.capturedAt=capture.capturedAt or os.clock()
        end
    end
    function E.waitForKiller()
        E.captureKiller()
        local capture=E.deathCapture
        return capture and ((not capture.captured and os.clock()-capture.started<5)
            or (capture.capturedAt and os.clock()-capture.capturedAt<0.15))
    end
    ;(function()
        local connection=RunService.RenderStepped:Connect(function()
            if not destroyed then E.captureKiller() end
        end)
        ScreenGui.Destroying:Connect(function() connection:Disconnect() end)
    end)()
    function E.atmHunterAway()
        if not currentCommand then return false end
        if currentCommand.hunter==LocalPlayer.UserId then return E.atmTripActive==true end
        local hunter=peers[currentCommand.hunter]
        return hunter and hunter.atmTripActive==true and type(hunter.updated)=="number"
            and timeNow()-hunter.updated>=0 and timeNow()-hunter.updated<2 or false
    end
    function E.atmPaused()
        return E.manualPaused==true or E.atmTripActive==true or E.atmHunterAway()
    end
    function E.atmCanStart() return true end
    function E.atmQueueTick()
        local now=timeNow()
        local leader=LocalPlayer.UserId
        for id,peer in pairs(peers) do
            if now-peer.updated>=0 and now-peer.updated<=6 and id<leader then leader=id end
        end
        local grant=read(file("atm_turn"))
        if leader==LocalPlayer.UserId then
            local holder=grant and peers[grant.userId]
            local keep=holder and holder.token==grant.token and (holder.atmTripActive or holder.atmRequest)
                and type(grant.expires)=="number" and grant.expires>now
            if not keep then
                local chosen=nil
                for id,peer in pairs(peers) do
                    if type(peer.atmRequest)=="number" and now-peer.updated>=0 and now-peer.updated<=6 then
                        if not chosen or peer.atmRequest<chosen.atmRequest or (peer.atmRequest==chosen.atmRequest and id<chosen.userId) then chosen=peer end
                    end
                end
                grant=chosen and {userId=chosen.userId,token=chosen.token,id=Http:GenerateGUID(false),expires=now+10} or nil
            end
            if grant then grant.expires=now+10; write(file("atm_turn"),grant) end
        end
        E.atmGrant=grant
    end
    function E.atmOwnTurn()
        if not capable then E.allowanceStatus="Allowance: shared files required for ATM turns"; return false end
        E.atmRequest=E.atmRequest or timeNow()
        local grant=E.atmGrant
        if not grant or grant.userId~=LocalPlayer.UserId or grant.token~=token or type(grant.expires)~="number" or grant.expires<=timeNow() then
            E.atmGrantSeen=nil
            E.allowanceStatus="Allowance: waiting for another account to finish at the ATM"
            return false
        end
        if E.atmGrantSeen~=grant.id then E.atmGrantSeen=grant.id; E.atmGrantSince=os.clock() end
        return os.clock()-E.atmGrantSince>=1
    end
    E.playerTPStatus="Select a player; only this account will pause."
    function E.startPlayerTP(id)
        if type(id)~="number" then E.playerTPStatus="Select a player first."; return end
        local player=Players:GetPlayerByUserId(id)
        if not player or player==LocalPlayer then E.playerTPStatus="Select another player in this server."; return end
        E.manualPaused=true
        if currentCommand then pausedCommand=currentCommand.id end
        if E.cancelAllowanceForManual then E.cancelAllowanceForManual() end
        E.playerTP={id=id,started=os.clock()}
        E.playerTPStatus="Teleporting; waiting for 3 stable seconds near the target."
    end
    function E.resumePlayerFarm()
        E.playerTP=nil; E.manualPaused=false; pausedCommand=nil
        E.playerTPStatus="Manual teleport stopped; this account can farm again."
    end
    ;(function()
        local last=0
        local connection=RunService.Heartbeat:Connect(function()
            local move=E.playerTP
            if destroyed or not move or os.clock()-last<0.25 then return end
            last=os.clock()
            if os.clock()-move.started>60 then E.playerTP=nil; E.playerTPStatus="Teleport timed out; account remains paused."; return end
            local player=Players:GetPlayerByUserId(move.id)
            if not player then E.playerTP=nil; E.playerTPStatus="Player left; account remains paused."; return end
            local own=LocalPlayer.Character
            local target=player.Character
            local root=own and own:FindFirstChild("HumanoidRootPart")
            local targetRoot=target and target:FindFirstChild("HumanoidRootPart")
            local hum=own and own:FindFirstChildOfClass("Humanoid")
            local targetHum=target and target:FindFirstChildOfClass("Humanoid")
            if not root or not targetRoot or not hum or hum.Health<=0 or not targetHum or targetHum.Health<=0 then move.since=nil; return end
            if move.character~=own or move.targetCharacter~=target then move.since=nil; move.character=own; move.targetCharacter=target end
            if (root.Position-targetRoot.Position).Magnitude<=6 then
                move.since=move.since or os.clock()
                if os.clock()-move.since>=3 then E.playerTP=nil; E.playerTPStatus="Arrived. This account remains paused until Resume." end
            else
                move.since=nil
                root.CFrame=targetRoot.CFrame*CFrame.new(0,0,3)
                root.AssemblyLinearVelocity=Vector3.zero; root.AssemblyAngularVelocity=Vector3.zero
            end
        end)
        ScreenGui.Destroying:Connect(function() connection:Disconnect(); E.playerTP=nil end)
    end)()
    E.peerCache={}
    function E.publishPeer(record)
        E.lastPeerRecord=record
        local primary=write(file(LocalPlayer.UserId),record)
        local backup=write(file(tostring(LocalPlayer.UserId).."_backup"),record)
        E.peerWriteOK=primary or backup
        return E.peerWriteOK
    end
    function E.readPeer(id)
        local now=timeNow()
        local best=nil
        for _,record in ipairs({read(file(id)) or false,read(file(tostring(id).."_backup")) or false,E.peerCache[id] or false}) do
            if type(record)=="table" and record.version==2 and record.userId==id and record.jobId==game.JobId
                and record.placeId==game.PlaceId and type(record.token)=="string" and type(record.updated)=="number"
                and now-record.updated>=-2 and now-record.updated<=6 then
                if not best or record.updated>best.updated then best=record end
            end
        end
        E.peerCache[id]=best
        return best
    end
    ;(function()
        local last=0
        local connection=RunService.Heartbeat:Connect(function()
            if destroyed or not capable or os.clock()-last<0.5 then return end
            last=os.clock()
            -- Keep discovery alive if a GUI or role update fails; never revive stale bounty/bank data.
            if E.lastPeerRecord and timeNow()-E.lastPeerRecord.updated<1 then return end
            local character=LocalPlayer.Character
            local hum=character and character:FindFirstChildOfClass("Humanoid")
            local record={version=2,userId=LocalPlayer.UserId,jobId=game.JobId,placeId=game.PlaceId,
                token=token,updated=timeNow(),health=hum and hum.Health,bankAvailable=false,
                discoveryOnly=true,atmTripActive=E.atmTripActive==true,manualPaused=E.manualPaused==true}
            pcall(E.publishPeer,record)
        end)
        ScreenGui.Destroying:Connect(function() connection:Disconnect() end)
    end)()
    function E.capture()
        return {hunter=currentCommand and currentCommand.hunter or 0,manager=currentCommand and currentCommand.manager or 0,
            recipient=E.options.recipient,mode=E.options.mode,safe=E.options.safe,
            void=voidConfig and voidConfig.enabled or false,teamPaused=teamPaused,
            accountPaused=currentCommand and pausedCommand==currentCommand.id or false,
            stamina=InfStamina_Enabled,antiAFK=E.getAFK and E.getAFK() or false,
            admin=E.getAdmin and E.getAdmin() or false,tracker=E.getTracker and E.getTracker() or false,
            webhook=E.webhook,meleeInterval=MELEE_INTERVAL}
    end
    function E.restore(config)
        E.pendingRestore={config=config,expires=os.clock()+30}
    end
    function E.respawnAllowed()
        local pending=E.pendingRestore
        if pending then
            local config=pending.config
            return config.hunter~=0 and not config.teamPaused and not config.accountPaused
        end
        return currentCommand~=nil and currentCommand.hunter~=0 and not teamPaused and pausedCommand~=currentCommand.id
    end
    function E.restoreTick()
        local pending=E.pendingRestore
        if not pending then return end
        local config=pending.config
        if config.hunter~=0 and not peers[config.hunter] or config.manager~=0 and not peers[config.manager] then
            E.configStatus="Waiting for saved hunter/manager to connect..."
            if os.clock()>pending.expires then E.pendingRestore=nil; E.autoSave=false; E.configStatus="Saved accounts unavailable. Auto save stopped; load again after connecting them." end
            return
        end
        if not E.setAFK or not E.setAdmin then return end
        E.pendingRestore=nil
        if not issue(config.hunter,config.manager) then E.autoSave=false; E.configStatus="Could not restore roles. Auto save stopped." return end
        E.change({recipient=config.recipient,mode=config.mode,safe=config.safe,requestId=Http:GenerateGUID(false),webhook=config.webhook,
            meleeInterval=config.meleeInterval or 0.05})
        if (voidConfig and voidConfig.enabled or false)~=config.void then toggleVoid() end
        if config.stamina then InfStamina_Enable() else InfStamina_Disable() end
        UpdateStaminaButton()
        E.setAFK(config.antiAFK); E.setAdmin(config.admin); E.setTracker(config.tracker)
        E.webhook=config.webhook
        pauseConfig={command=currentCommand.id,issuer=LocalPlayer.UserId,token=token,paused=config.teamPaused}
        write(file("team_pause"),pauseConfig); teamPaused=config.teamPaused
        pausedCommand=config.accountPaused and currentCommand.id or nil
        E.configStatus="Configuration loaded."
        E.profileBrowsing=false
        if E.refreshFields then E.refreshFields() end
    end

    function E.selectFallbackAccount(id)
        if not peers[id] and id~=LocalPlayer.UserId then ioStatus="Waiting for shared data from this player."; return end
        if selectionMode=="hunter" then issue(id)
        elseif selectionMode=="manager" then issue(currentCommand and currentCommand.hunter or 0,id)
        else ioStatus="Choose SELECT HUNTER or SELECT MANAGER first." end
    end
    function E.drawAccounts()
        local active={}
        local roster=Players:GetPlayers()
        table.sort(roster,function(a,b) return a.Name:lower()<b.Name:lower() end)
        for index,player in ipairs(roster) do
            local id=player.UserId
            if player==LocalPlayer or peers[id] then
                active[id]=true
                if not rows[id] or rows[id].Parent~=PlayerList then
                    local row=make("TextButton",{Size=UDim2.new(1,-16,0,40),Font=Enum.Font.GothamMedium,
                        TextSize=12,TextWrapped=true,TextColor3=Color3.new(1,1,1)},PlayerList)
                    row.Activated:Connect(function()
                        if player~=LocalPlayer and not peers[player.UserId] then ioStatus="Waiting for shared data from @"..player.Name; return end
                        if selectionMode=="manager" then
                            if issue(currentCommand and currentCommand.hunter or 0,player.UserId) then selectionMode=nil; Body.CanvasPosition=Vector2.zero end
                        elseif selectionMode=="hunter" then
                            if issue(player.UserId) then chosen=player; selectionMode=nil; Body.CanvasPosition=Vector2.zero end
                        else
                            ioStatus="Click SELECT HUNTER or SELECT MANAGER first."
                        end
                        if E.drawPanel then E.drawPanel() end
                    end)
                    rows[id]=row
                end
                rows[id].Visible=true
                rows[id].TextTransparency=0
                rows[id].LayoutOrder=player==LocalPlayer and -1 or index
                rows[id].Text=player.DisplayName .. " (@" .. player.Name .. ")" .. (player==LocalPlayer and " · YOU" or "") .. (peers[id] and " · CONNECTED" or player==LocalPlayer and " · LOCAL" or " · WAITING FOR SHARED DATA") .. (currentCommand and currentCommand.manager==id and " · MANAGER" or "") .. (currentCommand and currentCommand.hunter==id and " · HUNTER" or "")
                rows[id].BackgroundColor3=chosen==player and Color3.fromRGB(50,110,110) or Color3.fromRGB(35,42,60)
            end
        end
        for id,row in pairs(rows) do if not active[id] then row:Destroy(); rows[id]=nil end end
        local visibleCount=0; for _ in pairs(active) do visibleCount+=1 end
        PlayerList.CanvasSize=UDim2.fromOffset(0,visibleCount*44+16)
    end
    local function draw()
        stopTeam.Text=teamPaused and "RESUME TEAM" or "PAUSE TEAM"
        StopButton.Text=(currentCommand and pausedCommand==currentCommand.id) and "RESUME TP" or "PAUSE TP"
        note.Text=voidStatus~="" and (selectionStatus .. " | " .. voidStatus) or selectionStatus
        if chosen and chosen.Parent ~= Players then chosen=nil end
        targetInfo.Text=chosen and (chosen.DisplayName .. " (@" .. chosen.Name .. ")\nUserId: " .. chosen.UserId) or "Select an account to view its bounty"
        local sharedHunter=currentCommand and Players:GetPlayerByUserId(currentCommand.hunter)
        local viewed=sharedHunter or chosen
        if sharedHunter then targetInfo.Text="HUNTER: " .. sharedHunter.DisplayName .. " (@" .. sharedHunter.Name .. ")" end
        local data=viewed and peers[viewed.UserId]
        bountyInfo.Text=data and data.bounty and ("Hunter bounty: " .. data.bounty) or "Hunter bounty: no shared data"
        local manager=currentCommand and Players:GetPlayerByUserId(currentCommand.manager or 0)
        if FarmEarningsLabel then
            local money=manager and peers[manager.UserId]
            if not manager then FarmEarningsLabel.Text="Select manager"
            elseif not money or money.farmStarted~=true then FarmEarningsLabel.Text="Waiting for bank"
            elseif money.bankAvailable~=true or type(money.farmEarned)~="number" or money.farmEarned~=money.farmEarned
                or money.farmEarned<0 or money.farmEarned==math.huge then FarmEarningsLabel.Text="Bank unavailable"
            else FarmEarningsLabel.Text=formatEarned(money.farmEarned) end
        end
        selectHunter.Text=selectionMode=="hunter" and "SELECT HUNTER: click an account below" or
            (sharedHunter and ("SELECT HUNTER · @" .. sharedHunter.Name) or "SELECT HUNTER · unassigned")
        managerButton.Text=selectionMode=="manager" and "SELECT MANAGER: click an account below" or
            (manager and ("SELECT MANAGER · @" .. manager.Name) or "SELECT MANAGER · unassigned")
        local count=0
        for _ in pairs(peers) do count+=1 end
        local hunter=currentCommand and Players:GetPlayerByUserId(currentCommand.hunter)
        teamStatus.Text=(capable and ("Detected accounts: " .. count) or "No access to Potassium files") ..
            (hunter and (" · Hunter: @" .. hunter.Name) or " · Team stopped") .. "\n" .. roleStatus .. " " .. ioStatus
        E.drawAccounts()
    end
    ;(function()
        local elapsed=0
        local connection=RunService.Heartbeat:Connect(function(dt)
            elapsed+=dt
            if destroyed or elapsed<0.5 then return end
            elapsed=0
            local ok=pcall(E.drawAccounts)
            if not ok then ioStatus="Account list refresh failed; retrying." end
        end)
        ScreenGui.Destroying:Connect(function() connection:Disconnect() end)
        E.drawPanel=draw
        pcall(E.drawAccounts)
        PlayerList.CanvasPosition=Vector2.zero
    end)()
    task.spawn(function()
        while not destroyed and ScreenGui.Parent do
            local cycleOK, cycleError=pcall(function()
            fit()
            if capable then
                local label=GetOriginalBountyLabel()
                local bankAmount=getLocalBank()
                local character=LocalPlayer.Character
                if character and character~=lastCharacter then
                    lastCharacter=character
                    lifeToken=Http:GenerateGUID(false)
                end
                E.monitorDamage(character)
                E.resetLowHealth(character)
                local humanoid=character and character:FindFirstChildOfClass("Humanoid")
                local own={version=2,userId=LocalPlayer.UserId,jobId=game.JobId,placeId=game.PlaceId,
                    token=token,updated=timeNow(),bounty=label and label.Text or nil,
                    life=lifeToken,health=humanoid and humanoid.Health or nil,phase=state and state.phase or nil,command=state and state.command or nil,
                    hunterResetArmed=FistsReset_Enabled, attacking=MeleeAura_Enabled, killerRecord=E.killerRecord, atmTripActive=E.atmTripActive==true, atmRequest=E.atmRequest, manualPaused=E.manualPaused==true,
                    damageSeq=E.damageSeq or 0,damageAt=E.damageAt,damageAmount=E.damageAmount,damageCommand=E.damageCommand,damageLowHealth=E.damageLowHealth,
                    observedVoidReady=E.observeHunterVoid(currentCommand and Players:GetPlayerByUserId(currentCommand.hunter)),
                    observedVoidPositioned=E.observedVoidPositioned,
                    observedHunter=currentCommand and currentCommand.hunter or 0, observedCommand=currentCommand and currentCommand.id,
                    observedVoidId=voidConfig and voidConfig.id,
                    bank=bankAmount,bankAvailable=bankAmount~=nil,farmStarted=initialManagerBank~=nil,
                    initialBank=initialManagerBank,bankStartedAt=managerBankStartedAt,
                    farmEarned=(bankAmount~=nil and initialManagerBank~=nil) and math.max(0,bankAmount-initialManagerBank) or nil}
                E.publishPeer(own)
                peers={}
                for _,p in ipairs(Players:GetPlayers()) do
                    local d=E.readPeer(p.UserId)
                    if d and d.version==2 and d.userId==p.UserId and d.jobId==game.JobId and d.placeId==game.PlaceId
                        and type(d.token)=="string" and type(d.updated)=="number"
                        and timeNow()-d.updated>=-2 and timeNow()-d.updated<=6 then
                        if type(d.bounty)~="string" or #d.bounty>200 then d.bounty=nil end
                        peers[p.UserId]=d
                    end
                end
                peers[LocalPlayer.UserId]=own
                SharedParticipants=peers
                E.atmQueueTick()
                syncVoid()
                E.sync()
                local command=read(file("command")) or currentCommand
                local issuer=command and peers[command.issuer]
                if command and command.version==2 and type(command.id)=="string" and type(command.hunter)=="number"
                    and issuer and issuer.token==command.token and (command.hunter==0 or peers[command.hunter]) then
                    currentCommand=command
                    local sharedPause=read(file("team_pause")) or pauseConfig
                    local pauseOwner=sharedPause and peers[sharedPause.issuer]
                    if sharedPause and sharedPause.command==command.id and type(sharedPause.paused)=="boolean"
                        and pauseOwner and pauseOwner.token==sharedPause.token then
                        pauseConfig=sharedPause; teamPaused=sharedPause.paused
                    else teamPaused=false; pauseConfig=nil end
                    local hunter=Players:GetPlayerByUserId(command.hunter)
                    local manager=Players:GetPlayerByUserId(command.manager or 0)
                    local h=peers[command.hunter]
                    local m=peers[command.manager or 0]
                    local bounty=h and parseBounty(h.bounty)
                    -- Capture once per manager script session, never on pause/resume.
                    if manager==LocalPlayer and hunter and not teamPaused and pausedCommand~=command.id
                        and initialManagerBank==nil and bankAmount~=nil then
                        initialManagerBank=bankAmount
                        managerBankStartedAt=timeNow()
                        own.farmStarted=true; own.initialBank=initialManagerBank
                        own.bankStartedAt=managerBankStartedAt; own.farmEarned=0
                        E.publishPeer(own)
                    end
                    if applied~=command.id then
                        stopRole(); lastRole=nil; state=nil
                        applied=command.id; pausedCommand=nil; chosen=hunter
                    end
                    local diskState=read(file("cycle"))
                    if diskState and diskState.command==command.id and diskState.issuer==command.issuer
                        and diskState.token==command.token and type(diskState.updated)=="number"
                        and timeNow()-diskState.updated>=-2 and timeNow()-diskState.updated<=6 then
                        state=diskState
                    end
                    if state and (type(state.updated)~="number" or timeNow()-state.updated>6) then state=nil end
                    
                    if command.issuer==LocalPlayer.UserId and command.token==token then
                        state=state or {command=command.id,issuer=command.issuer,token=token,phase="farm",round=1}
                        if not hunter then state.phase="stopped"
                        elseif teamPaused then state.updated=timeNow()
                        elseif E.advanceGift(command,h,bounty) then
                        elseif h and type(h.health)=="number" and h.health<=0 then state.phase="respawn"
                        elseif state.phase=="farm" and bounty and bounty>=THRESHOLD then
                            state.phase="prepare"; state.life=h.life
                        elseif state.phase=="prepare" and m and manager~=hunter then
                            
                            if h.command==command.id and h.phase=="prepare" and h.hunterResetArmed==true then state.phase="collect" end
                        elseif state.phase=="collect" then
                            if (type(h.health)=="number" and h.health<=0) or (h.life and h.life~=state.life) then
                                state.phase="respawn"
                            end
                        elseif state.phase=="respawn" then
                            if type(h.health)=="number" and h.health>0
                                and bounty and bounty<THRESHOLD then
                                state.phase="farm"; state.round=(state.round or 1)+1; state.giftExempt=false
                            end
                        end
                        E.trackMoney(command,h,m,bounty)
                        state.updated=timeNow()
                        if not write(file("cycle"),state) then state=nil end
                    end
                    local phase=state and state.phase
                    local hunterCapped=bounty and bounty>=THRESHOLD
                    local role="idle"
                    if hunter and pausedCommand~=command.id and not teamPaused then
                        if phase=="give" and hunter==LocalPlayer then role="gift"
                        elseif phase=="farm" and not hunterCapped then
                            if hunter==LocalPlayer then
                                if bounty~=nil and (not manager or (m and m.farmStarted==true)) then role="hunter" end
                            else role="follower" end
                        elseif phase==nil and hunter~=LocalPlayer then
                            
                            role="follower"
                        elseif (phase=="prepare" or phase=="collect") and hunter==LocalPlayer then
                            role="hunter_reset"
                        elseif phase=="collect" and m and manager~=hunter then
                            if manager==LocalPlayer then role="manager" end
                        elseif phase=="respawn" and hunter==LocalPlayer then role="respawn" end
                    end
                    E.safeWaiting=false
                    E.hunterEquipped=false
                    if hunter==LocalPlayer and phase=="farm" and not hunterCapped and not teamPaused and pausedCommand~=command.id then
                        E.hunterEquipped=E.managerFistsReady(LocalPlayer.Character)
                    end
                    if E.options.safe and voidConfig and voidConfig.enabled then
                        if (role=="follower" or role=="manager") and not E.observeHunterVoid(hunter) then role="idle"; E.safeWaiting=true end
                    end
                    if E.atmPaused() then role="idle" end
                    if role~=lastRole then stopRole(); lastRole=role end
                    SharedAttackTargets={}; SharedFinishing=false; SharedHunterRespawn=false; SharedStopAtCap=false
                    if AutoTP_Enabled then AutoTP_Disable(); UpdateAutoTPButton() end
                    if AutoSafeEnabled then AutoSafe_Disable() end
                    E.giftDamage=false
                    if role=="gift" then
                        E.applyGift(role)
                    elseif role=="hunter" then
                        SharedStopAtCap=true
                        if E.hunterEquipped then
                            for id in pairs(peers) do
                                if id~=command.hunter and E.targetVoidReady(id,command) then SharedAttackTargets[id]=true end
                            end
                            if not MeleeAura_Enabled then MeleeAura_Enable(); UpdateMeleeButton() end
                        elseif MeleeAura_Enabled then MeleeAura_Disable(); UpdateMeleeButton() end
                    elseif role=="follower" or role=="manager" then
                        if not teleporting or selectedPlayer~=hunter or not teleportConnection or not teleportConnection.Connected then StartTeleport(hunter) end
                        
                        local myCharacter=LocalPlayer.Character
                        local myHum=myCharacter and myCharacter:FindFirstChildOfClass("Humanoid")
                        local myRoot=myCharacter and myCharacter:FindFirstChild("HumanoidRootPart")
                        local hunterCharacter=hunter.Character
                        local hunterHum=hunterCharacter and hunterCharacter:FindFirstChildOfClass("Humanoid")
                        local hunterRoot=hunterCharacter and hunterCharacter:FindFirstChild("HumanoidRootPart")
                        if not myHum or myHum.Health<=0 then
                            followStatus="Waiting for this account to respawn"
                        elseif not myRoot or not hunterRoot or not hunterHum or hunterHum.Health<=0 then
                            followStatus="Waiting for the hunter to be alive"
                        else
                            selectedPlayer=hunter
                            teleporting=true
                            local destination=hunterRoot.CFrame*CFrame.new(0,0,-TP_DISTANCE)
                            if (myRoot.Position-destination.Position).Magnitude>2 then
                                myRoot.CFrame=destination
                            end
                            followStatus="TP towards @" .. hunter.Name
                        end
                        if role=="manager" then
                            FistsReset_Disable()
                            if E.managerFistsReady(LocalPlayer.Character) then
                                SharedFinishing=true
                                SharedAttackTargets[command.hunter]=true
                                if not MeleeAura_Enabled then MeleeAura_Enable(); UpdateMeleeButton() end
                            else
                                if MeleeAura_Enabled then MeleeAura_Disable(); UpdateMeleeButton() end
                                followStatus="Waiting for manager fists; retrying equipment"
                            end
                        else
                            if not FistsReset_Enabled then FistsReset_Enable() end
                            if MeleeAura_Enabled then MeleeAura_Disable(); UpdateMeleeButton() end
                        end
                    elseif role=="hunter_reset" then
                        -- Arm before the manager receives permission to attack.
                        if teleporting then StopTeleport() end
                        if MeleeAura_Enabled then MeleeAura_Disable(); UpdateMeleeButton() end
                        if not FistsReset_Enabled then FistsReset_Enable() end
                    elseif role=="respawn" then
                        SharedHunterRespawn=true
                    else
                        if teleporting or MeleeAura_Enabled then stopRole() end
                    end
                    -- Respawn every participating account, including an idle manager at the cap.
                    if hunter and not teamPaused and pausedCommand~=command.id then
                        SharedHunterRespawn=true
                    end
                    E.snapshot={hunter=command.hunter,manager=command.manager,
                        bank=m and m.bankAvailable and m.bank or nil,earned=m and m.farmEarned or nil,
                        elapsed=farmClock and farmClock.elapsed or 0,running=hunter~=nil and not teamPaused and pausedCommand~=command.id,
                        theftCount=state and state.theftCount or 0,theftMessage=state and state.theftMessage,
                        theftAmount=state and state.theftAmount or 0,theftTotal=state and state.theftTotal or 0,
                        theftInterval=state and state.theftInterval or 60, theftKiller=state and state.theftKiller, theftKillerStatus=state and E.killerPresence(state.theftKillerUserId),
                        theftPending=state and state.theftPending or false}
                    local labels={give_prepare="Delivery: waiting for team attacks to stop",give="Delivering bounty to selected player",farm="Farming",prepare="10k: paused, waiting for manager",collect="Manager attacking only the hunter",respawn="Waiting for respawn and bounty below 10k",stopped="Team stopped"}
                    roleStatus=(labels[phase] or "Waiting for coordinator") .. " · Cycle " .. tostring(state and state.round or 1)
                    if bounty==nil and hunter then
                        roleStatus=role=="follower" and "TP active; waiting for hunter bounty" or "Hunter assigned; waiting for bounty data"
                    end
                    if role=="follower" or role=="manager" then roleStatus=roleStatus .. " · " .. followStatus end
                    if role=="follower" and manager==LocalPlayer then roleStatus=roleStatus .. " · Manager participating in farming" end
                    if role=="hunter" then
                        local targets=0
                        for _ in pairs(SharedAttackTargets) do targets+=1 end
                        if not E.hunterEquipped then roleStatus="Hunter waiting for Fists in Backpack; retrying equipment"
                        elseif targets==0 then roleStatus="Hunter ready; waiting for eligible accounts / void observations" end
                    end
                    if hunter==LocalPlayer and manager and phase=="farm" and (not m or m.farmStarted~=true) then roleStatus="Waiting for the manager initial bank balance" end
                    if E.safeWaiting then roleStatus="Safe farm: waiting for observer-confirmed hunter position in the void" end
                    if teamPaused then roleStatus="Team paused; hunter and manager retained" end
                    if pausedCommand==command.id then roleStatus="This account is paused" end
                else
                    E.snapshot.running=false
                    currentCommand=nil; state=nil; lastRole=nil; teamPaused=false; pauseConfig=nil
                    stopRole()
                    roleStatus="No valid command: check workspace and detected accounts"
                    applied=nil
                end

            end
            E.restoreTick()
            updateFarmClock()
            E.recoverVoid()
            tickVoid()
            draw()
            end)
            if not cycleOK then
                stopRole(); lastRole=nil; E.snapshot.running=false
                SharedAttackTargets={}
                ioStatus="Error: " .. tostring(cycleError):sub(1,140)
                teamStatus.Text="Synchronization interrupted; retrying.\n" .. ioStatus
                warn("HW synchronization:", cycleError)
            end
            task.wait(0.5)
        end
        SharedParticipants={}; SharedAttackTargets={}; SharedHunterRespawn=false; SharedFinishing=false
    end)
end)()
UpdateStaminaButton()
UpdateMeleeButton()
UpdateAutoTPButton()
AutoSafeUpdateButton()
UpdateBounty()

;(function()
local staffPlayers = {
    groups = {
        [4165692] = {
            ["Tester"] = true, ["Contributor"] = true, ["Tester+"] = true, ["Developer"] = true,
            ["Developer+"] = true, ["Community Manager"] = true, ["Manager"] = true, ["Owner"] = true
        },
        [32406137] = {
            ["Junior"] = true, ["Moderator"] = true, ["Senior"] = true, ["Administrator"] = true,
            ["Manager"] = true, ["Holder"] = true
        },
        [8024440] = {
            ["zzzz"] = true, ["reshape enjoyer"] = true, ["i heart reshape"] = true, ["reshape superfan"] = true
        },
        [14927228] = {
            ["♞"] = true
        }
    },
    users = {
         3294804378, 93676120, 54087314, 81275825, 140837601, 1229486091, 46567801, 418086275, 29706395,
         3717066084, 1424338327, 5046662686, 5046661126, 5046659439, 418199326, 1024216621, 1810535041,
         63238912, 111250044, 63315426, 730176906, 141193516, 194512073, 193945439, 412741116, 195538733,
         102045519, 955294, 957835150, 25689921, 366613818, 281593651, 455275714, 208929505, 96783330,
         156152502, 93281166, 959606619, 142821118, 632886139, 175931803, 122209625, 278097946, 142989311,
         1517131734, 446849296, 87189764, 67180844, 9212846, 47352513, 48058122, 155413858, 10497435,
         513615792, 55893752, 55476024, 151691292, 136584758, 16983447, 3111449, 94693025, 271400893,
         5005262660, 295331237, 64489098, 244844600, 114332275, 25048901, 69262878, 50801509, 92504899,
         42066711, 50585425, 31365111, 166406495, 2457253857, 29761878, 21831137, 948293345, 439942262,
         38578487, 1163048, 7713309208, 3659305297, 15598614, 34616594, 626833004, 198610386, 153835477,
         3923114296, 3937697838, 102146039, 119861460, 371665775, 1206543842, 93428604, 1863173316, 90814576,
         374665997, 423005063, 140172831, 42662179, 9066859, 438805620, 14855669, 727189337, 1871290386,
         608073286
    }
}

    local enabled, generation, exiting = false, 0, false
    local kickOnTracker = false
    local GroupService = game:GetService("GroupService")
    local ids, cache, trackerWarnings = {}, {}, {}
    for _, id in ipairs(staffPlayers.users) do ids[id]=true end
    local function ui(class, props)
        local obj=Instance.new(class)
        for k,v in pairs(props) do obj[k]=v end
        obj.Parent=Body
        return obj
    end
    Body.CanvasSize=UDim2.fromOffset(0,1160)
    for _,child in ipairs(Body:GetChildren()) do
        if child:IsA("TextLabel") and child.Position.Y.Offset==905 then child.Position=UDim2.fromOffset(16,1110) end
    end
    local toggle=ui("TextButton", {Name="AdminCheckToggle",Position=UDim2.fromOffset(16,910),Size=UDim2.new(1,-32,0,40),
        Text="ADMIN CHECK: OFF",Font=Enum.Font.GothamBold,TextSize=13,TextWrapped=true,
        TextColor3=Color3.new(1,1,1),BackgroundColor3=Color3.fromRGB(42,49,70)})
    local trackerToggle=ui("TextButton", {Name="TrackerCheckMode",Position=UDim2.fromOffset(16,956),Size=UDim2.new(1,-32,0,40),
        Text="TRACKER$: WARN ONLY",Font=Enum.Font.GothamBold,TextSize=13,
        TextColor3=Color3.new(1,1,1),BackgroundColor3=Color3.fromRGB(42,49,70)})
    local status=ui("TextLabel", {Name="AdminCheckStatus",Position=UDim2.fromOffset(16,1004),Size=UDim2.new(1,-32,0,98),
        Text="Checks the configured list, not actual admin permissions. Disconnects on an ID or role match.",
        Font=Enum.Font.Gotham,TextSize=12,TextWrapped=true,TextXAlignment=Enum.TextXAlignment.Left,
        TextColor3=Color3.fromRGB(220,226,240),BackgroundTransparency=1})
    local function active(g)
        return enabled and generation==g and not destroyed and not exiting and ScreenGui.Parent~=nil
    end
    local function exitFor(player, reason, g)
        if not active(g) or player.Parent~=Players then return end
        exiting=true; enabled=false; generation+=1
        status.Text="Match: @" .. player.Name .. " | " .. reason
        toggle.Text="ADMIN CHECK: MATCH DETECTED"
        SharedAttackTargets={}; SharedHunterRespawn=false
        StopTeleport(); MeleeAura_Disable(); InfStamina_Disable()
        AutoTP_Disable(); AutoSafe_Disable()
        destroyed=true
        LocalPlayer:Kick("Admin Check: configured match\n@" .. player.Name .. " (" .. player.UserId .. ")\n" .. reason)
    end
    local function tracker(player)
        local suffix="Tracker$"
        for _,child in ipairs(player:GetChildren()) do
            if child.Name:sub(-#suffix)==suffix then
                local name=child.Name:sub(1,-#suffix-1)
                if Players:FindFirstChild(name) then return name end
            end
        end
    end
    local function inspectRoles(player,g)
        local failed=false
        for groupId,allowed in pairs(staffPlayers.groups) do
            if not active(g) or player.Parent~=Players then return nil,false end
            local ok,result=pcall(function() return GroupService:GetRolesInGroupAsync(player.UserId,groupId) end)
            if not active(g) or player.Parent~=Players then return nil,false end
            if ok and type(result)=="table" and type(result.Roles)=="table" then
                for _,role in ipairs(result.Roles) do
                    if allowed[role.Name] then return "Role " .. role.Name .. " in group " .. groupId,false end
                end
            else
                
                local fallbackOk,role=pcall(function() return player:GetRoleInGroup(groupId) end)
                if not active(g) or player.Parent~=Players then return nil,false end
                if fallbackOk and type(role)=="string" then
                    if allowed[role] then return "Role " .. role .. " in group " .. groupId,false end
                else failed=true end
            end
            task.wait(0.15)
        end
        return nil,failed
    end
    local function setEnabled(value)
        generation+=1; enabled=value
        local g=generation
        toggle.Text=value and "ADMIN CHECK: ON (DISCONNECT ON ID/ROLE MATCH)" or "ADMIN CHECK: OFF"
        toggle.BackgroundColor3=value and Color3.fromRGB(125,65,50) or Color3.fromRGB(42,49,70)
        status.Text=value and "Checking current and new players..." or "Disabled; pending queries cannot trigger a disconnect."
        if not value then return end
        cache={}; trackerWarnings={}
        
        task.spawn(function()
            while active(g) do
                for _,player in ipairs(Players:GetPlayers()) do
                    if player~=LocalPlayer then
                        if ids[player.UserId] then exitFor(player,"UserId in the supplied list",g); return end
                        local tracked=tracker(player)
                        if tracked then
                            if kickOnTracker then exitFor(player,"Tracker$ linked to " .. tracked .. " (heuristic)",g); return end
                            trackerWarnings[player.UserId]="@" .. player.Name .. ": Tracker$ for " .. tracked
                        else trackerWarnings[player.UserId]=nil end
                    end
                end
                task.wait(1)
            end
        end)
        
        task.spawn(function()
            while active(g) do
                for _,player in ipairs(Players:GetPlayers()) do
                    if not active(g) then return end
                    if player~=LocalPlayer then
                        local record=cache[player.UserId]
                        if not record or os.clock()>=record.expires then
                            local reason,failed=inspectRoles(player,g)
                            if not active(g) then return end
                            if player.Parent==Players then
                                if reason then exitFor(player,reason,g); return end
                                cache[player.UserId]={expires=os.clock()+(failed and 15 or 120),failed=failed}
                            end
                        end
                    end
                end
                task.wait(1)
            end
        end)
        task.spawn(function()
            while active(g) do
                local checked,pending,errors=0,0,0
                local warning=nil
                for _,player in ipairs(Players:GetPlayers()) do
                    if player~=LocalPlayer then
                        local record=cache[player.UserId]
                        if not record then pending+=1 elseif record.failed then errors+=1 else checked+=1 end
                        warning=warning or trackerWarnings[player.UserId]
                    end
                end
                status.Text="Configured list: " .. checked .. " checked | " .. pending .. " pending | " .. errors .. " errors (retrying)." ..
                    (warning and ("\nWarning, not proof of admin: " .. warning) or "\nNo matches detected so far.")
                task.wait(1)
            end
        end)
    end
    toggle.Activated:Connect(function() if not destroyed and not exiting then setEnabled(not enabled) end end)
    trackerToggle.Activated:Connect(function()
        kickOnTracker=not kickOnTracker
        trackerToggle.Text=kickOnTracker and "TRACKER$: DISCONNECT ON DETECTION" or "TRACKER$: WARN ONLY"
    end)
    local removing=Players.PlayerRemoving:Connect(function(player) cache[player.UserId]=nil; trackerWarnings[player.UserId]=nil end)
    ScreenGui.Destroying:Connect(function() enabled=false; generation+=1; removing:Disconnect() end)
    E.setAdmin=setEnabled
    E.getAdmin=function() return enabled end
    E.getTracker=function() return kickOnTracker end
    E.setTracker=function(value)
        kickOnTracker=value
        trackerToggle.Text=value and "TRACKER$: DISCONNECT ON DETECTION" or "TRACKER$: WARN ONLY"
    end
    setEnabled(true)

end)()

    ;(function()
        E.allowanceEnabled=false
        E.allowanceStatus="Allowance: disabled"
        local lastCheck=0
        local attemptedAt=nil
        local openSince=nil
        local openButton=nil
        local attempted=false
        local busy=false
        local function path(names)
            local node=LocalPlayer
            for _,name in ipairs(names) do node=node and node:FindFirstChild(name) end
            return node
        end
        local function containsDigits(text)
            if text:find("%d") then return true end
            for _,code in utf8.codes(text) do
                for _,zero in ipairs({0x660,0x6F0,0x966,0x9E6,0xA66,0xAE6,0xB66,0xBE6,0xC66,0xCE6,0xD66,0xE50,0xED0,0x1040,0x17E0,0xFF10}) do
                    if code>=zero and code<=zero+9 then return true end
                end
            end
            return false
        end
        local function visibleButton(button)
            if not button or not button:IsA("GuiButton") or not button.Active then return false end
            local node=button
            while node and node~=LocalPlayer do
                if node:IsA("GuiObject") and not node.Visible then return false end
                if node:IsA("ScreenGui") and not node.Enabled then return false end
                if node:IsA("PlayerGui") then return true end
                node=node.Parent
            end
            return false
        end
        local trip=nil
        local retryAfter=0
        local promptShown={}
        local shownConnection=game:GetService("ProximityPromptService").PromptShown:Connect(function(prompt) promptShown[prompt]=true end)
        local hiddenConnection=game:GetService("ProximityPromptService").PromptHidden:Connect(function(prompt) promptShown[prompt]=nil end)
        local function localRoot()
            local character=LocalPlayer.Character
            local hum=character and character:FindFirstChildOfClass("Humanoid")
            return hum and hum.Health>0 and character:FindFirstChild("HumanoidRootPart") or nil
        end
        local lastMoveAt=-math.huge
        local function moveToward(root,destination)
            if os.clock()-lastMoveAt<0.5 then return end
            lastMoveAt=os.clock()
            if (root.Position-destination.Position).Magnitude>3 then
                root.CFrame=destination
                root.AssemblyLinearVelocity=Vector3.zero
                root.AssemblyAngularVelocity=Vector3.zero
            end
        end
        local function returnTrip(message)
            if trip and trip.phase~="return" then
                trip.phase="return"; trip.returnAt=os.clock(); trip.result=message
            end
        end
        local function cancelDeadTrip()
            trip=nil; busy=false; attempted=false; attemptedAt=nil; openButton=nil; openSince=nil
            E.atmTripActive=false; E.atmRequest=nil; E.atmGrantSeen=nil
            retryAfter=os.clock()+5
            E.allowanceStatus="Allowance: trip cancelled after death; waiting for respawn"
        end
        E.cancelAllowanceForManual=cancelDeadTrip
        local function claimInRange(activeTrip)
            if not activeTrip or trip~=activeTrip or activeTrip.phase~="claim" or LocalPlayer.Character~=activeTrip.character then return false end
            local root=localRoot()
            local prompt=activeTrip.prompt
            local parent=prompt and prompt.Parent
            if not root or not parent then return false end
            local position=parent:IsA("Attachment") and parent.WorldPosition or parent:IsA("BasePart") and parent.Position
            return position~=nil and (root.Position-position).Magnitude<=prompt.MaxActivationDistance
        end
        local function tickTrip()
            if not trip then return false end
            local now=os.clock()
            if LocalPlayer.Character~=trip.character or not localRoot() then cancelDeadTrip(); return true end
            if not E.allowanceEnabled then returnTrip("Allowance trip cancelled") end
            if now-trip.started>25 then returnTrip("Allowance: ATM timeout; farm resumed") end
            if trip.phase=="return" then
                local root=localRoot()
                if root then moveToward(root,trip.origin) end
                if root and (root.Position-trip.origin.Position).Magnitude<=3 then
                    trip.arrived=trip.arrived or now
                else trip.arrived=nil end
                if (trip.arrived and now-trip.arrived>=1) or now-trip.returnAt>=8 then
                    E.allowanceStatus=trip.result
                    trip=nil; E.atmTripActive=false; E.atmRequest=nil; E.atmGrantSeen=nil; retryAfter=now+60
                else E.allowanceStatus="Allowance: returning to farm position" end
                return true
            end
            return false
        end

        local openAttemptAt=-math.huge
        local openAttempts=0
        local function openTargetATM()
            local map=workspace:FindFirstChild("Map")
            local folder=map and map:FindFirstChild("ATMz")
            local target=Vector3.new(-4399.7793,3.8208952,196.223145)
            local model=nil
            local best=2
            for _,candidate in ipairs(folder and folder:GetChildren() or {}) do
                if candidate:IsA("Model") then
                    local distance=(candidate:GetPivot().Position-target).Magnitude
                    if distance<best then model=candidate; best=distance end
                end
            end
            local main=model and model:FindFirstChild("MainPart")
            local attachment=main and main:FindFirstChild("posA")
            local prompt=attachment and attachment:FindFirstChild("ProximityPrompt")
            if not prompt or not prompt:IsA("ProximityPrompt") then
                local root=localRoot()
                if trip and root then moveToward(root,CFrame.new(target+Vector3.new(4,3,0))) end
                E.allowanceStatus="Allowance: moving to designated ATM; waiting for map load"; return
            end
            local character=LocalPlayer.Character
            local root=character and character:FindFirstChild("HumanoidRootPart")
            local hum=character and character:FindFirstChildOfClass("Humanoid")
            if not root or not hum or hum.Health<=0 then E.allowanceStatus="Allowance: waiting for character"; return end
            local position=attachment:IsA("Attachment") and attachment.WorldPosition or main.Position
            local distance=(root.Position-position).Magnitude
            if distance>math.min(prompt.MaxActivationDistance,5) and trip then
                moveToward(root,CFrame.new(position+Vector3.new(3,1,0)))
                E.allowanceStatus="Allowance: moving into ATM prompt range"; return
            end
            if distance>prompt.MaxActivationDistance or not promptShown[prompt] then
                E.allowanceStatus="Allowance: waiting for visible ATM prompt"
                if trip and os.clock()-trip.started>5 then
                    local offsets={Vector3.new(3,1,0),Vector3.new(-3,1,0),Vector3.new(0,1,3),Vector3.new(0,1,-3)}
                    moveToward(root,CFrame.new(position+offsets[math.floor((os.clock()-trip.started)/3)%4+1]))
                end
                return
            end
            if not prompt.Enabled then E.allowanceStatus="Allowance: waiting for ATM prompt"; return end
            if type(fireproximityprompt)~="function" then E.allowanceStatus="Allowance: fireproximityprompt unavailable"; return end
            if busy then return end
            if openAttempts>=3 then E.allowanceStatus="Allowance: ATM did not open; toggle to retry"; return end
            if os.clock()-openAttemptAt<4 then E.allowanceStatus="Allowance: waiting for ATM menu to open"; return end
            openAttempts+=1; openAttemptAt=os.clock(); busy=true
            E.allowanceStatus="Allowance: opening designated ATM"
            local activeTrip=trip
            task.spawn(function()
                if activeTrip and trip==activeTrip and activeTrip.phase=="claim" and E.allowanceEnabled and not destroyed and prompt.Parent and prompt.Enabled
                    and LocalPlayer.Character==character and hum.Health>0
                    and (root.Position-position).Magnitude<=prompt.MaxActivationDistance then
                    activeTrip.prompt=prompt
                    local ok=pcall(fireproximityprompt,prompt)
                    if not ok then E.allowanceStatus="Allowance: ATM interaction failed" end
                end
                busy=false
            end)
        end

        local function tick()
            if E.manualPaused then E.allowanceStatus="Allowance: paused for manual player teleport"; return end
            if tickTrip() then return end
            local button=path({"PlayerGui","CoreGUI","ATMFrame","ATMFrame","AllowanceFrame","ClaimButton","TextButton"})
            if not visibleButton(button) then openSince=nil; openButton=nil; attempted=false end
            if not E.allowanceEnabled then E.atmRequest=nil; E.allowanceStatus="Allowance: disabled"; return end
            local amount=path({"PlayerGui","CoreGUI","StatsFrame","Frame2","Frame","Container","Allowance","Amt"})
            if not amount then E.allowanceStatus="Allowance: waiting for counter"; return end
            local text=amount.Text:gsub("<[^>]*>",""):match("^%s*(.-)%s*$")
            if text=="" then E.allowanceStatus="Allowance: counter unavailable"; return end
            if containsDigits(text) then
                if not trip then E.atmRequest=nil end
                E.allowanceStatus="Allowance countdown: "..text
                attemptedAt=nil
                if trip and trip.claimSent then returnTrip("Allowance: timer restarted; farm resumed") end
                return
            end
            if not trip then
                if os.clock()<retryAfter then return end
                local root=localRoot()
                if not root then E.allowanceStatus="Allowance: waiting for character"; return end
                if not E.atmOwnTurn or not E.atmOwnTurn() then return end
                trip={origin=root.CFrame,started=os.clock(),phase="claim",character=LocalPlayer.Character}
                E.atmTripActive=true; attempted=false; openAttempts=0; openAttemptAt=-math.huge
                return
            end
            if not trip.prompt or not visibleButton(button) then openTargetATM(); return end
            if not claimInRange(trip) then
                local root=localRoot()
                local parent=trip.prompt and trip.prompt.Parent
                local position=parent and (parent:IsA("Attachment") and parent.WorldPosition or parent:IsA("BasePart") and parent.Position)
                if root and position then moveToward(root,CFrame.new(position+Vector3.new(3,1,0))) end
                attempted=false; E.allowanceStatus="Allowance: retrying ATM position before claim"; return
            end
            if openButton~=button then openButton=button; openSince=os.clock(); attempted=false end
            if busy then return end
            if attempted then E.allowanceStatus="Allowance: claim attempted; close and reopen the ATM if no timer appears"; return end
            if type(getconnections)~="function" or type(firesignal)~="function" then E.allowanceStatus="Allowance: signal functions unavailable"; return end
            local callbacks=getconnections(button.MouseButton1Click)
            local available=false
            for _,connection in ipairs(callbacks) do
                if connection.Enabled and connection.LuaConnection and not connection.ForeignState then available=true; break end
            end
            if not available then E.allowanceStatus="Allowance: click handler unavailable; ATM code needed"; return end
            busy=true; attempted=true; attemptedAt=os.clock()
            E.allowanceStatus="Attempting claim; counter reads ["..text.."]"
            local activeTrip=trip
            task.spawn(function()
                task.wait(0.1)
                if trip~=activeTrip then return end
                if LocalPlayer.Character~=activeTrip.character or not localRoot() then cancelDeadTrip(); return end
                if destroyed or not E.allowanceEnabled or not visibleButton(button) or openButton~=button or not claimInRange(activeTrip) then
                    busy=false; attempted=false; E.allowanceStatus="Allowance: checking ATM position and menu again"; return
                end
                activeTrip.claimSent=true
                local ok=pcall(firesignal,button.MouseButton1Click)
                if trip~=activeTrip then return end
                busy=false
                if not ok then E.allowanceStatus="Allowance: claim action failed" end
            end)
        end
        E.toggleAllowance=function()
            E.allowanceEnabled=not E.allowanceEnabled
            openAttempts=0; openAttemptAt=-math.huge
            -- Toggling does not send another click into an already-used menu.
            attemptedAt=nil
        end
        local connection=RunService.Heartbeat:Connect(function()
            if destroyed or os.clock()-lastCheck<0.1 then return end
            lastCheck=os.clock()
            local ok=pcall(tick)
            if not ok then E.allowanceStatus="Allowance: UI not ready; retrying" end
        end)
        ScreenGui.Destroying:Connect(function()
            connection:Disconnect(); shownConnection:Disconnect(); hiddenConnection:Disconnect()
            E.atmTripActive=false; E.atmRequest=nil
            local root=localRoot()
            if trip and root then pcall(moveToward,root,trip.origin) end
        end)
    end)()
;(function()
    local Http=game:GetService("HttpService")
    E.webhook={enabled=false,url="",interval=300}
    E.webhookStatus="Webhook disabled."
    E.configStatus="Profiles are stored in the shared executor workspace."
    E.autoSave=false
    E.profile="default"
    local lastSaved=nil
    local lastSave=0
    local lastPost=0
    local posting=false
    local retryAt=0
    local function filename(name)
        if type(name)~="string" or not name:match("^[%w_-]+$") or #name>40 then return nil end
        return "Autofarm_Config_"..game.PlaceId.."_"..LocalPlayer.UserId.."_"..name..".json"
    end
    local pointer="Autofarm_Autoload_"..game.PlaceId.."_"..LocalPlayer.UserId..".json"
    local profileIndex="Autofarm_ProfileIndex_"..game.PlaceId.."_"..LocalPlayer.UserId..".json"
    E.savedProfiles={}
    E.profileListStatus="Refreshing saved profiles..."
    E.profileBrowsing=false
    local function profileEntry(path)
        if type(path)~="string" then return nil end
        local base=path:gsub("\\","/"):match("([^/]+)$")
        if not base then return nil end
        local owner,name=base:match("^Autofarm_Config_"..game.PlaceId.."_(%d+)_([%w_-]+)%.json$")
        if not owner or #name>40 then return nil end
        return {path=base,name=name,owner=tonumber(owner)}
    end
    function E.profilePath()
        if E.selectedProfile and E.selectedProfile.name==E.profile then return E.selectedProfile.path end
        return filename(E.profile)
    end
    function E.refreshProfiles()
        local found={}
        local function add(path)
            local entry=profileEntry(path)
            if not entry then return end
            local ok,exists=pcall(function() return isfile(entry.path) end)
            if ok and exists then found[entry.path]=entry end
        end
        local scanned=false
        if type(listfiles)=="function" then
            for _,root in ipairs({".",""}) do
                local ok,paths=pcall(listfiles,root)
                if ok and type(paths)=="table" then
                    for _,path in ipairs(paths) do add(path) end
                    scanned=true
                    if next(found) then break end
                end
            end
        end
        pcall(function()
            local record=Http:JSONDecode(readfile(profileIndex))
            if type(record.paths)=="table" then for _,path in ipairs(record.paths) do add(path) end end
        end)
        for _,entry in ipairs(E.savedProfiles) do add(entry.path) end
        add(filename("default"))
        add(E.profilePath())
        pcall(function()
            local record=Http:JSONDecode(readfile(pointer))
            add(record.path or filename(record.profile))
        end)
        E.savedProfiles={}
        local paths={}
        for path,entry in pairs(found) do table.insert(E.savedProfiles,entry); table.insert(paths,path) end
        table.sort(E.savedProfiles,function(a,b)
            if a.name:lower()==b.name:lower() then return a.path<b.path end
            return a.name:lower()<b.name:lower()
        end)
        table.sort(paths)
        pcall(function() writefile(profileIndex,Http:JSONEncode({version=1,paths=paths})) end)
        E.profileListStatus=tostring(#E.savedProfiles).." saved profiles"..(scanned and " · this game, all accounts" or " · listing unavailable; showing known profiles")
    end
    function E.selectProfile(entry)
        E.pendingRestore=nil
        E.selectedProfile=entry; E.profile=entry.name
        E.profileBrowsing=true
        E.configStatus="Selected "..entry.name..". Press LOAD to apply it. Auto save is held while browsing."
        if E.refreshFields then E.refreshFields() end
    end
    local function validUrl(url)
        return type(url)=="string" and #url<400 and url:match("^https://discord%.com/api/webhooks/%d+/[%w_-]+$")~=nil
    end
    local sharedHookId=nil
    function E.acceptSharedHook(hook)
        if type(hook)~="table" or type(hook.enabled)~="boolean" or type(hook.url)~="string"
            or (hook.url~="" and not validUrl(hook.url)) or (hook.enabled and not validUrl(hook.url))
            or type(hook.interval)~="number" or hook.interval~=hook.interval or hook.interval<30 or hook.interval>86400 then return end
        local id=tostring(hook.enabled)..hook.url..tostring(hook.interval)
        if id==sharedHookId then return end
        sharedHookId=id
        E.webhook={url=hook.url,interval=hook.interval,enabled=hook.enabled}
        lastPost=os.clock(); retryAt=0
        E.webhookStatus=hook.enabled and "Shared webhook enabled; only the manager sends reports." or "Webhook disabled."
        if E.refreshFields then E.refreshFields() end
    end
    function E.validate(config)
        assert(type(config)=="table","Configuration must be a JSON object")
        if config.meleeInterval~=nil then
            assert(type(config.meleeInterval)=="number" and config.meleeInterval>=0.05 and config.meleeInterval<=2,"Melee interval must be 0.05–2 seconds")
        end
        for _,key in ipairs({"hunter","manager","recipient"}) do
            local n=config[key]
            assert(type(n)=="number" and n>=0 and n<1e16 and n%1==0,"Invalid "..key)
        end
        assert(config.hunter==0 or config.hunter~=config.manager,"Hunter and manager must differ")
        assert(config.recipient==0 or config.recipient~=config.hunter,"Recipient cannot be the hunter")
        assert(config.mode=="off" or config.mode=="manual" or config.mode=="auto","Invalid delivery mode")
        for _,key in ipairs({"safe","void","teamPaused","accountPaused","stamina","antiAFK","admin","tracker"}) do
            assert(type(config[key])=="boolean","Invalid "..key)
        end
        assert(config.safeRecovery==nil or type(config.safeRecovery)=="boolean","Invalid safe recovery mode")
        local hook=config.webhook
        assert(type(hook)=="table" and type(hook.enabled)=="boolean" and type(hook.url)=="string","Invalid webhook settings")
        assert(hook.url=="" or validUrl(hook.url),"Use a Discord webhook URL without query parameters")
        assert(not hook.enabled or validUrl(hook.url),"Enabled webhook requires a URL")
        assert(type(hook.interval)=="number" and hook.interval>=30 and hook.interval<=86400,"Webhook interval must be 30–86400 seconds")
        return config
    end
    function E.saveProfile()
        if E.pendingRestore then E.configStatus="Wait for the configuration to finish loading before saving." return end
        local path=E.profilePath()
        if not path then E.configStatus="Profile name: 1–40 letters, digits, underscores or hyphens." return end
        local ok=pcall(function()
            local config=E.validate(E.capture())
            local encoded=Http:JSONEncode({version=1,config=config})
            writefile(path,encoded)
            lastSaved=encoded
            writefile(pointer,Http:JSONEncode({enabled=false,profile=E.profile,path=path}))
        end)
        if ok then
            E.selectedProfile=profileEntry(path); E.profileBrowsing=false
            table.insert(E.savedProfiles,E.selectedProfile)
            E.refreshProfiles()
        end
        E.configStatus=ok and ("Saved "..path) or "Save failed: check settings and workspace access."
    end
    function E.loadProfile()
        local path=E.profilePath()
        if not path then E.configStatus="Invalid profile name." return end
        local ok,result=pcall(function()
            local record=Http:JSONDecode(readfile(path))
            assert(record.version==1,"Unsupported profile version")
            return E.validate(record.config)
        end)
        if ok then
            E.selectedProfile=profileEntry(path); E.profileBrowsing=true
            E.restore(result); E.configStatus="Loading "..E.profile.."..."
        else E.autoSave=false; E.configStatus="Load failed: missing or invalid profile. Auto save stopped to preserve it." end
    end
    function E.exportProfile()
        return Http:JSONEncode({version=1,config=E.capture()})
    end
    function E.editSelectedProfile()
        local path=E.profilePath()
        if not path then E.configStatus="Select a saved profile first." return nil end
        local ok,raw=pcall(function()
            local text=readfile(path)
            local record=Http:JSONDecode(text)
            assert(record.version==1,"Unsupported version")
            E.validate(record.config)
            return text
        end)
        if not ok then E.configStatus="Cannot edit this profile: missing or invalid file." return nil end
        E.profileBrowsing=true
        E.configStatus="Editing saved profile. APPLY EDITED JSON loads changes; SAVE writes them."
        return raw
    end
    function E.importProfile(raw)
        local ok,result=pcall(function()
            assert(#raw<30000,"Profile too large")
            local record=Http:JSONDecode(raw)
            assert(record.version==1,"Unsupported version")
            return E.validate(record.config)
        end)
        if ok then E.restore(result); E.configStatus="Applying edited configuration; SAVE writes it to the profile."
        else E.configStatus="Invalid JSON configuration; no changes applied." end
    end
    function E.toggleSave()
        E.autoSave=not E.autoSave
        if E.autoSave then E.saveProfile()
        else
            local ok=pcall(function() writefile(pointer,Http:JSONEncode({enabled=false,profile=E.profile,path=E.profilePath()})) end)
            E.configStatus=ok and "Auto save/load disabled; existing profiles retained." or "Could not update auto-load preference."
        end
    end
    function E.configureHook(url,interval,enabled)
        url=url:match("^%s*(.-)%s*$")
        local seconds=tonumber(interval)
        if (url~="" and not validUrl(url)) or (enabled and not validUrl(url)) then E.webhookStatus="Enter a valid discord.com webhook URL." return end
        if not seconds or seconds~=seconds or seconds<30 or seconds>86400 then E.webhookStatus="Interval: 30–86400 seconds." return end
        E.webhook={url=url,interval=seconds,enabled=enabled}
        E.change({webhook=E.webhook})
        lastPost=os.clock(); retryAt=0
        E.webhookStatus=enabled and "Enabled. Only the manager sends while the team is farming." or "Webhook disabled."
    end
    local function postTick()
        local hook=E.webhook
        local snap=E.snapshot
        if not hook.enabled or posting or not snap.running or snap.manager~=LocalPlayer.UserId
            or type(snap.bank)~="number" or type(snap.earned)~="number" then return end
        if os.clock()<retryAt or os.clock()-lastPost<hook.interval then return end
        local requestFn=request or http_request or (syn and syn.request)
        if type(requestFn)~="function" then E.webhookStatus="HTTP request function unavailable."; retryAt=os.clock()+60; return end
        posting=true; lastPost=os.clock()
        local url=hook.url
        local payload=Http:JSONEncode({allowed_mentions={parse={}},embeds={{title="AUTOFARM",color=4445108,
            fields={{name="Money earned",value=tostring(snap.earned),inline=true},
                {name="Manager total money",value=tostring(snap.bank),inline=true},
                {name="Possible bounty theft incidents",value=tostring(snap.theftCount or 0),inline=true},
                {name="Last captured theft killer",value=tostring(snap.theftKiller or "Not captured yet"),inline=false},
                {name="Killer server status",value=tostring(snap.theftKillerStatus or "Identity unverified"),inline=false},
                {name="Money lost (estimated)",value="Current: "..tostring(snap.theftAmount or 0).." | Total: "..tostring(snap.theftTotal or 0)
                    ,inline=false},
                {name="Farm time",value=string.format("%02d:%02d:%02d",math.floor(snap.elapsed/3600),math.floor(snap.elapsed/60)%60,math.floor(snap.elapsed)%60)}}}}})
        task.spawn(function()
            local ok,response=pcall(requestFn,{Url=url.."?wait=true",Method="POST",Headers={["Content-Type"]="application/json"},Body=payload})
            posting=false
            if destroyed then return end
            local status=ok and type(response)=="table" and tonumber(response.StatusCode)
            if status and status>=200 and status<300 then E.webhookStatus="Report sent successfully."
            elseif status==429 then
                local delay=60
                pcall(function() delay=tonumber(Http:JSONDecode(response.Body).retry_after) or 60 end)
                retryAt=os.clock()+math.clamp(delay,1,86400)
                E.webhookStatus="Discord rate limit; waiting before retrying."
            elseif status==401 or status==403 or status==404 then
                E.webhook.enabled=false; E.webhookStatus="Webhook rejected or deleted; disabled."
            else retryAt=os.clock()+60; E.webhookStatus="Report failed; retrying later. URL is not logged." end
        end)
    end
    task.spawn(function()
        task.wait(2)
        -- Discover saved profiles only. Loading and enabling auto-save require user actions.
        E.refreshProfiles()
        while not destroyed and ScreenGui.Parent do
            local tickOK=pcall(function()
                if E.autoSave and not E.profileBrowsing and not E.pendingRestore and os.clock()-lastSave>=5 then
                    lastSave=os.clock()
                    local encoded=Http:JSONEncode({version=1,config=E.capture()})
                    if encoded~=lastSaved then E.saveProfile() end
                end
                postTick()
            end)
            if not tickOK then E.configStatus="Background settings check failed; retrying." end
            task.wait(1)
        end
    end)
end)()

;(function()
    local connections={}
    local alive=true
    local accent=Color3.fromRGB(67,211,180)
    local bg=Color3.fromRGB(15,20,30)
    local panelColor=Color3.fromRGB(25,33,47)
    local function connect(signal,fn)
        local c=signal:Connect(fn); table.insert(connections,c); return c
    end
    local function make(class,props,parent)
        local obj=Instance.new(class)
        for k,v in pairs(props) do obj[k]=v end
        obj.Parent=parent
        return obj
    end
    local function round(obj)
        local corner=obj:FindFirstChildOfClass("UICorner") or make("UICorner",{},obj)
        corner.CornerRadius=UDim.new(0,10)
    end
    local function place(obj,x,y,w,h)
        obj.Position=UDim2.fromOffset(x,y); obj.Size=UDim2.fromOffset(w,h)
    end
    
    local old={}
    for _,obj in ipairs(Body:GetChildren()) do
        if obj:IsA("GuiObject") then old[obj.Position.Y.Offset]=obj end
    end
    local teamStatus,targetInfo,bountyInfo=old[135],old[186],old[242]
    local hunterButton,managerButton,stopTeam=old[298],old[344],old[390]
    local voidButton,note=old[436],old[1110]
    local adminButton=Body:FindFirstChild("AdminCheckToggle")
    local trackerButton=Body:FindFirstChild("TrackerCheckMode")
    local adminStatus=Body:FindFirstChild("AdminCheckStatus")
    assert(teamStatus and targetInfo and bountyInfo and hunterButton and managerButton and stopTeam and voidButton and note,"Base panel controls are missing")
    Main.BackgroundColor3=bg
    Main.Size=UDim2.fromOffset(620,700)
    Main.Position=UDim2.new(0.5,-310,0.5,-350)
    Main.ClipsDescendants=true
    round(Main)
    local stroke=Main:FindFirstChildOfClass("UIStroke") or make("UIStroke",{},Main)
    stroke.Color=Color3.fromRGB(56,76,94); stroke.Thickness=1
    Title.Text="AUTOFARM"
    Title.TextSize=18; Title.TextColor3=accent
    Body.Position=UDim2.fromOffset(0,106)
    Body.Size=UDim2.new(1,0,1,-143)
    Body.ScrollBarImageColor3=accent
    Body.ScrollBarThickness=4
    Subtitle.Visible=false; SelectedLabel.Visible=false
    local nav=make("Frame",{Name="Navigation",Position=UDim2.fromOffset(16,57),Size=UDim2.new(1,-32,0,38),BackgroundTransparency=1},Main)
    local footer=make("TextLabel",{Name="SessionStats",Position=UDim2.new(0,16,1,-31),Size=UDim2.new(1,-32,0,24),
        BackgroundTransparency=1,Font=Enum.Font.Gotham,TextSize=11,TextColor3=Color3.fromRGB(154,176,193),TextXAlignment=Enum.TextXAlignment.Left,Text="Starting statistics..."},Main)
    local tabs,groups={}, {Team={},Controls={},Safety={},["Give Bounty"]={},Settings={}}
    local currentTab="Team"
    local function add(tab,obj,x,y,w,h)
        if tab=="Settings" and y>=38 then y+=230 end
        if tab=="Team" and y>=6 then y+=90 end
        obj.Parent=Body; place(obj,x,y,w,h); table.insert(groups[tab],obj)
        if obj:IsA("TextButton") then
            round(obj); obj.TextSize=13; obj.TextWrapped=true; obj.Font=Enum.Font.GothamBold
            obj.BorderSizePixel=0; obj.AutoButtonColor=true
        end
    end
    local function label(tab,caption,y)
        local obj=make("TextLabel",{Text=caption,TextColor3=Color3.fromRGB(144,164,185),Font=Enum.Font.GothamBold,
            TextSize=11,TextXAlignment=Enum.TextXAlignment.Left,BackgroundTransparency=1},Body)
        add(tab,obj,20,y,574,24)
        return obj
    end
    add("Team",teamStatus,20,6,574,60)
    teamStatus.TextSize=13
    add("Team",targetInfo,20,78,574,48)
    add("Team",bountyInfo,20,130,574,45)
    bountyInfo.TextSize=27; bountyInfo.TextColor3=accent
    BountyFrame.Visible=false
    BountyFrame.Parent=nil
    local timerCard=make("Frame",{Name="FarmTime",BackgroundColor3=panelColor,BorderSizePixel=0},Body)
    round(timerCard)
    add("Team",timerCard,20,183,282,45)
    make("TextLabel",{Text="FARM TIME",Position=UDim2.fromOffset(12,3),Size=UDim2.new(1,-24,0,15),
        BackgroundTransparency=1,Font=Enum.Font.GothamBold,TextSize=10,TextColor3=Color3.fromRGB(144,164,185),TextXAlignment=Enum.TextXAlignment.Left},timerCard)
    FarmTimerLabel=make("TextLabel",{Text="00:00:00",Position=UDim2.fromOffset(12,19),Size=UDim2.new(1,-24,0,23),
        BackgroundTransparency=1,Font=Enum.Font.GothamBold,TextSize=17,TextColor3=accent,TextXAlignment=Enum.TextXAlignment.Left},timerCard)
    BountyTitle.TextSize=12
    BountyValue.TextSize=16
    local earningsCard=make("Frame",{Name="TotalFarmed",BackgroundColor3=panelColor,BorderSizePixel=0},Body)
    round(earningsCard)
    add("Team",earningsCard,312,183,282,45)
    make("TextLabel",{Text="TOTAL FARMED",Position=UDim2.fromOffset(12,3),Size=UDim2.new(1,-24,0,15),
        BackgroundTransparency=1,Font=Enum.Font.GothamBold,TextSize=10,TextColor3=Color3.fromRGB(144,164,185),TextXAlignment=Enum.TextXAlignment.Left},earningsCard)
    FarmEarningsLabel=make("TextLabel",{Text="Select manager",Position=UDim2.fromOffset(12,19),Size=UDim2.new(1,-24,0,23),
        BackgroundTransparency=1,Font=Enum.Font.GothamBold,TextSize=17,TextColor3=accent,TextXAlignment=Enum.TextXAlignment.Left},earningsCard)
    BountyFrame.BackgroundColor3=panelColor
    add("Team",hunterButton,20,244,282,48)
    add("Team",managerButton,312,244,282,48)
    hunterButton.BackgroundColor3=Color3.fromRGB(34,94,93)
    managerButton.BackgroundColor3=Color3.fromRGB(88,64,125)
    add("Team",stopTeam,20,302,282,40)
    add("Team",StopButton,312,302,282,40)
    add("Team",voidButton,20,354,574,46)
    label("Team","DETECTED ACCOUNTS · CHOOSE A ROLE, THEN AN ACCOUNT",412)
    add("Team",PlayerList,20,442,574,180)
    PlayerList.BackgroundColor3=panelColor
    add("Team",note,20,635,574,62)
    note.TextSize=12
    label("Controls","ACCOUNT CONTROLS",6)

    MeleeButton.Visible=false; MeleeButton.Parent=nil
    add("Controls",StaminaButton,20,38,574,46)
    AutoTPButton.Visible=false; AutoTPButton.Parent=nil
    AutoSafeButton.Visible=false; AutoSafeButton.Parent=nil

    label("Controls","SESSION",108)
    local afkButton=make("TextButton",{Name="AntiAFKToggle",Text="ANTI AFK: OFF",TextColor3=Color3.new(1,1,1),BackgroundColor3=panelColor},Body)
    add("Controls",afkButton,20,140,574,46)
    local afkStatus=make("TextLabel",{Text="Enable on each account. Does not move your character or change the hunter.",BackgroundTransparency=1,
        TextColor3=Color3.fromRGB(178,195,207),Font=Enum.Font.Gotham,TextSize=12,TextWrapped=true,TextXAlignment=Enum.TextXAlignment.Left},Body)
    add("Controls",afkStatus,20,196,574,62)
    label("Safety","ADMIN CHECK · THIS ACCOUNT",6)
    add("Safety",adminButton,20,42,574,50)
    add("Safety",trackerButton,20,106,574,46)
    add("Safety",adminStatus,20,170,574,128)
    local securityNote=make("TextLabel",{Text="Admin Check can disconnect this account on a configured match. Tracker$ is a heuristic and only warns by default.",BackgroundTransparency=1,
        TextColor3=Color3.fromRGB(178,195,207),Font=Enum.Font.Gotham,TextSize=12,TextWrapped=true,TextXAlignment=Enum.TextXAlignment.Left},Body)
    add("Safety",securityNote,20,318,574,75)
    ;(function()
        local hovering=false
        local savedVisibility=nil
        local function restoreCursor()
            if savedVisibility~=nil then
                UserInputService.MouseIconEnabled=savedVisibility
                savedVisibility=nil
            end
        end
        connect(Main.MouseEnter,function() hovering=true end)
        connect(Main.MouseLeave,function() hovering=false; restoreCursor() end)
        connect(RunService.RenderStepped,function()
            if hovering and ScreenGui.Enabled and Main.Visible and Main.Parent then
                if savedVisibility==nil then savedVisibility=UserInputService.MouseIconEnabled end
                UserInputService.MouseIconEnabled=true
            else
                restoreCursor()
            end
        end)
        connect(ScreenGui.Destroying,restoreCursor)
    end)()
    ;(function()
        local function button(tab,text,y,callback)
            local obj=make("TextButton",{Text=text,BackgroundColor3=panelColor,TextColor3=Color3.new(1,1,1)},Body)
            add(tab,obj,20,y,574,42)
            connect(obj.Activated,callback)
            return obj
        end
        local function box(tab,placeholder,y,text,height)
            local obj=make("TextBox",{Text=text or "",PlaceholderText=placeholder,ClearTextOnFocus=false,
                BackgroundColor3=panelColor,TextColor3=Color3.new(1,1,1),PlaceholderColor3=Color3.fromRGB(150,165,185),
                TextSize=13,Font=Enum.Font.Code,TextWrapped=true,MultiLine=(height or 42)>50},Body)
            add(tab,obj,20,y,574,height or 42); round(obj)
            return obj
        end
        local allowance=button("Controls","AUTO CLAIM ALLOWANCE: OFF",444,function() E.toggleAllowance() end)
        local allowanceStatus=label("Controls","Allowance: disabled",496)
        allowanceStatus.TextWrapped=true; allowanceStatus.Size=UDim2.fromOffset(574,64)
        ;(function()
            local chosen=nil
            label("Controls","TELEPORT TO PLAYER · THIS ACCOUNT ONLY",584)
            local list=make("ScrollingFrame",{BackgroundColor3=panelColor,BorderSizePixel=0,ScrollBarThickness=5,CanvasSize=UDim2.fromOffset(0,0)},Body)
            add("Controls",list,20,624,574,180)
            make("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},list)
            button("Controls","TELEPORT TO SELECTED PLAYER",814,function() E.startPlayerTP(chosen) end)
            button("Controls","CANCEL TP / RESUME THIS ACCOUNT",864,function() E.resumePlayerFarm() end)
            local status=label("Controls","",914)
            status.TextWrapped=true; status.Size=UDim2.fromOffset(574,65)
            local rows={}
            local elapsed=0
            connect(RunService.Heartbeat,function(dt)
                elapsed+=dt; if elapsed<0.5 then return end; elapsed=0
                status.Text=E.playerTPStatus
                local present={}; local count=0
                for _,player in ipairs(Players:GetPlayers()) do
                    if player~=LocalPlayer then
                        local id=player.UserId; present[id]=true; count+=1
                        if not rows[id] then
                            local row=make("TextButton",{Size=UDim2.new(1,-8,0,34),TextColor3=Color3.new(1,1,1),BorderSizePixel=0},list)
                            rows[id]=row
                            connect(row.Activated,function() chosen=id end)
                        end
                        rows[id].Text=player.DisplayName.." (@"..player.Name..")"
                        rows[id].BackgroundColor3=chosen==id and Color3.fromRGB(34,94,93) or panelColor
                    end
                end
                for id,row in pairs(rows) do if not present[id] then row:Destroy(); rows[id]=nil end end
                list.CanvasSize=UDim2.fromOffset(0,count*38)
            end)
        end)()
        ;(function()
            local expanded=false
            local toggle=button("Team","ACCOUNT MISSING? SELECT HERE",750,function()
                expanded=not expanded
                if E.refreshServerFallback then E.refreshServerFallback() end
            end)
            local list=make("ScrollingFrame",{Name="ServerPlayersFallback",Position=UDim2.fromOffset(20,892),
                Size=UDim2.fromOffset(574,200),BackgroundColor3=panelColor,BorderSizePixel=0,
                ScrollBarThickness=5,CanvasSize=UDim2.fromOffset(0,0),Visible=false},Body)
            make("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},list)
            local rows={}
            E.refreshServerFallback=function()
                list.Visible=expanded and currentTab=="Team"
                toggle.Text=expanded and "HIDE ACCOUNT SELECTION" or "ACCOUNT MISSING? SELECT HERE"
                if currentTab=="Team" then Body.CanvasSize=UDim2.fromOffset(0,expanded and 1110 or 900) end
                if not list.Visible then return end
                local present={}; local roster=Players:GetPlayers()
                table.sort(roster,function(a,b) return a.Name:lower()<b.Name:lower() end)
                for index,player in ipairs(roster) do
                    local id=player.UserId; present[id]=true
                    if not rows[id] then
                        rows[id]=make("TextButton",{Size=UDim2.new(1,-8,0,38),TextColor3=Color3.new(1,1,1),BackgroundColor3=panelColor,
                            TextSize=12,TextWrapped=true,BorderSizePixel=0},list)
                        connect(rows[id].Activated,function() E.selectFallbackAccount(id) end)
                    end
                    rows[id].Text=player.DisplayName.." (@"..player.Name..")"
                    rows[id].LayoutOrder=index
                end
                for id,row in pairs(rows) do if not present[id] then row:Destroy(); rows[id]=nil end end
                list.CanvasSize=UDim2.fromOffset(0,#roster*42+8)
            end
            local elapsed=0
            connect(RunService.Heartbeat,function(dt)
                elapsed+=dt; if elapsed<0.5 then return end; elapsed=0
                E.refreshServerFallback()
            end)
        end)()


        local total=label("Team","MANAGER TOTAL MONEY: waiting for data",710)
        local meleeCaption=label("Controls","MELEE ATTACK INTERVAL",282)
        local meleeSlider=make("TextButton",{Text="",BackgroundTransparency=1,AutoButtonColor=false,Selectable=true},Body)
        add("Controls",meleeSlider,20,316,574,40)
        local rail=make("Frame",{Position=UDim2.new(0,0,0.5,-4),Size=UDim2.new(1,0,0,8),
            BackgroundColor3=panelColor,BorderSizePixel=0},meleeSlider)
        round(rail)
        local fill=make("Frame",{Size=UDim2.new(0,0,1,0),BackgroundColor3=accent,BorderSizePixel=0},rail)
        round(fill)
        local knob=make("Frame",{AnchorPoint=Vector2.new(0.5,0.5),Position=UDim2.new(0,0,0.5,0),Size=UDim2.fromOffset(20,20),
            BackgroundColor3=accent,BorderSizePixel=0},rail)
        round(knob)
        local meleeHelp=label("Controls","LEFT: FASTER · RIGHT: SLOWER\nShared with the team. A longer interval means fewer attack attempts.",368)
        meleeHelp.TextWrapped=true; meleeHelp.Size=UDim2.fromOffset(574,54)
        local dragInput=nil
        local dragValue=nil
        local function updateMeleeSlider()
            local seconds=dragValue or MELEE_INTERVAL
            local fraction=math.clamp((seconds-0.05)/1.95,0,1)
            fill.Size=UDim2.new(fraction,0,1,0); knob.Position=UDim2.new(fraction,0,0.5,0)
            meleeCaption.Text=string.format("MELEE INTERVAL: %.2f s · UP TO %.1f ATTEMPTS / SECOND",seconds,1/seconds)
        end
        local function dragTo(x)
            if meleeSlider.AbsoluteSize.X<=0 then return end
            local fraction=math.clamp((x-meleeSlider.AbsolutePosition.X)/meleeSlider.AbsoluteSize.X,0,1)
            E.setMeleeInterval(0.05+fraction*1.95)
            dragValue=MELEE_INTERVAL
            updateMeleeSlider()
        end
        connect(meleeSlider.InputBegan,function(input)
            if input.UserInputType==Enum.UserInputType.MouseButton1 or input.UserInputType==Enum.UserInputType.Touch then
                dragInput=input; E.meleeDragging=true; dragTo(input.Position.X)
            end
        end)
        connect(UserInputService.InputChanged,function(input)
            if not dragInput or destroyed then return end
            if input==dragInput or (dragInput.UserInputType==Enum.UserInputType.MouseButton1 and input.UserInputType==Enum.UserInputType.MouseMovement) then
                dragTo(input.Position.X)
            end
        end)
        connect(UserInputService.InputEnded,function(input)
            if dragInput and (input==dragInput or (dragInput.UserInputType==Enum.UserInputType.MouseButton1 and input.UserInputType==Enum.UserInputType.MouseButton1)) then
                local value=dragValue or MELEE_INTERVAL
                dragInput=nil; dragValue=nil; E.meleeDragging=false
                if not destroyed then E.change({meleeInterval=value}) end
            end
        end)
        updateMeleeSlider()
        local theft=make("TextLabel",{Text="POSSIBLE BOUNTY THEFT: 0",TextWrapped=true,TextSize=15,
            Font=Enum.Font.GothamBold,TextColor3=Color3.fromRGB(240,210,145),BackgroundColor3=Color3.fromRGB(53,40,25),
            BorderSizePixel=0},Body)
        add("Team",theft,20,0,574,78); place(theft,20,6,574,78); round(theft)
        local safe=button("Safety","SAFE FARM: OFF",414,function()
            E.change({safe=not E.options.safe})
        end)
        local explanation=label("Safety","Followers verify the void position. If all reporting accounts see the hunter outside while it sees itself inside for 3 seconds, the hunter resets and retries. No detour teleport.",466)
        explanation.TextWrapped=true; explanation.Size=UDim2.fromOffset(574,70)
        label("Give Bounty","RECIPIENT · ALL SERVER PLAYERS",6)
        local selected=label("Give Bounty","No recipient selected",38)
        local roster=make("ScrollingFrame",{BackgroundColor3=panelColor,BorderSizePixel=0,ScrollBarThickness=5,
            CanvasSize=UDim2.fromOffset(0,0)},Body)
        add("Give Bounty",roster,20,74,574,205)
        make("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},roster)
        local once=button("Give Bounty","GIVE BOUNTY · TP ONCE AT 10K",294,function() E.give("manual") end)
        local automatic=button("Give Bounty","AUTO GIVE BOUNTY: OFF",346,function()
            E.give(E.options.mode=="auto" and "off" or "auto")
        end)
        button("Give Bounty","CANCEL DELIVERY · RETURN TO MANAGER",398,function() E.give("off") end)
        local giftStatus=label("Give Bounty","",456)
        giftStatus.TextWrapped=true; giftStatus.Size=UDim2.fromOffset(574,90)
        local limitation=label("Give Bounty","Any damage triggers reset during delivery. The attacker cannot be verified by this script.",552)
        limitation.TextWrapped=true; limitation.Size=UDim2.fromOffset(574,54)
        label("Settings","CONFIGURATION PROFILES",6)
        local name=box("Settings","Profile name",38,E.profile)
        connect(name.FocusLost,function()
            if E.profile~=name.Text then E.profileBrowsing=true; E.pendingRestore=nil end
            E.profile=name.Text
        end)
        local profiles=make("ScrollingFrame",{BackgroundColor3=panelColor,BorderSizePixel=0,ScrollBarThickness=5,
            CanvasSize=UDim2.fromOffset(0,0)},Body)
        add("Settings",profiles,20,0,574,145); place(profiles,20,38,574,145)
        make("UIListLayout",{Padding=UDim.new(0,4),SortOrder=Enum.SortOrder.LayoutOrder},profiles)
        local refreshProfiles=make("TextButton",{Text="REFRESH SAVED PROFILES",TextColor3=Color3.new(1,1,1),BackgroundColor3=panelColor},Body)
        add("Settings",refreshProfiles,20,0,574,36); place(refreshProfiles,20,190,574,36)
        connect(refreshProfiles.Activated,E.refreshProfiles)
        local profileStatus=label("Settings","",0); place(profileStatus,20,232,574,30)
        profileStatus.TextWrapped=true
        local profileRows={}
        local autoSave=button("Settings","AUTO SAVE: OFF",90,function() E.profile=name.Text; E.toggleSave() end)
        button("Settings","SAVE / OVERWRITE PROFILE",140,function() E.profile=name.Text; E.saveProfile() end)
        button("Settings","LOAD PROFILE",190,function() E.profile=name.Text; E.loadProfile() end)
        local configStatus=label("Settings","",240)
        configStatus.Size=UDim2.fromOffset(574,58); configStatus.TextWrapped=true
        local editor=box("Settings","Export settings to edit their JSON here.",310,"",130)
        editor.TextXAlignment=Enum.TextXAlignment.Left; editor.TextYAlignment=Enum.TextYAlignment.Top
        button("Settings","EDIT SELECTED PROFILE",450,function()
            local raw=E.editSelectedProfile()
            if raw then editor.Text=raw end
        end)
        button("Settings","APPLY EDITED JSON",500,function() E.importProfile(editor.Text) end)
        label("Settings","DISCORD WEBHOOK · REPORTS FROM MANAGER ONLY",560)
        local url=box("Settings","https://discord.com/api/webhooks/...",592,"")
        local interval=box("Settings","Interval in seconds (30–86400)",644,"300")
        local hook=button("Settings","WEBHOOK: OFF",696,function()
            E.configureHook(url.Text,interval.Text,not E.webhook.enabled)
        end)
        button("Settings","APPLY WEBHOOK URL / INTERVAL",746,function()
            E.configureHook(url.Text,interval.Text,E.webhook.enabled)
        end)
        local hookStatus=label("Settings","",802)
        hookStatus.TextWrapped=true; hookStatus.Size=UDim2.fromOffset(574,60)
        local privacy=label("Settings","Profiles include the webhook URL in plain text. No report is sent until enabled. In-flight requests may finish after disabling.",870)
        privacy.TextWrapped=true; privacy.Size=UDim2.fromOffset(574,65)
        function E.refreshFields()
            name.Text=E.profile; url.Text=E.webhook.url; interval.Text=tostring(E.webhook.interval)
        end
        local rows={}
        local function refresh()
            updateMeleeSlider()
            allowance.Text=E.allowanceEnabled and "AUTO CLAIM ALLOWANCE: ON" or "AUTO CLAIM ALLOWANCE: OFF"
            allowanceStatus.Text=E.allowanceStatus.."\nMay not work if the game rejects teleporting or ATM interactions."
            local snap=E.snapshot
            total.Text="MANAGER TOTAL MONEY: "..(snap.bank and ("$"..tostring(snap.bank)) or "unavailable")
            theft.Text="POSSIBLE BOUNTY THEFT: "..tostring(snap.theftCount or 0)
                .."\nMoney lost (estimated): $"..tostring(snap.theftAmount or 0).." current / $"..tostring(snap.theftTotal or 0).." total"
                .."\nLast captured theft killer: "..tostring(snap.theftKiller or "Not captured yet").." · "..tostring(snap.theftKillerStatus or "Identity unverified")
            theft.BackgroundColor3=(snap.theftCount or 0)>0 and Color3.fromRGB(115,34,35) or Color3.fromRGB(53,40,25)
            safe.Text=E.options.safe and "SAFE FARM: ON" or "SAFE FARM: OFF"
            local recipient=Players:GetPlayerByUserId(E.options.recipient)
            selected.Text=recipient and ("RECIPIENT: @"..recipient.Name) or "No recipient selected"
            local enabled=recipient~=nil and E.options.recipient~=snap.hunter
            once.Active=enabled; once.AutoButtonColor=enabled
            once.TextTransparency=enabled and 0 or 0.5
            automatic.Text=E.options.mode=="auto" and "AUTO GIVE BOUNTY: ON" or "AUTO GIVE BOUNTY: OFF"
            giftStatus.Text=E.status
            autoSave.Text=E.autoSave and "AUTO SAVE: ON" or "AUTO SAVE: OFF"
            configStatus.Text=E.configStatus
            profileStatus.Text=E.profileListStatus
            local saved={}
            for index,entry in ipairs(E.savedProfiles) do
                saved[entry.path]=true
                if not profileRows[entry.path] then
                    local row=make("TextButton",{Size=UDim2.new(1,-10,0,34),TextSize=12,Font=Enum.Font.Gotham,
                        TextColor3=Color3.new(1,1,1),BorderSizePixel=0,TextWrapped=true},profiles)
                    connect(row.Activated,function() E.selectProfile(entry) end)
                    profileRows[entry.path]=row
                end
                local row=profileRows[entry.path]
                row.LayoutOrder=index
                local chosen=E.selectedProfile and E.selectedProfile.path==entry.path and E.profile==entry.name
                row.Text=(chosen and "SELECTED · " or "")..entry.name.." · Account "..entry.owner
                row.BackgroundColor3=chosen and Color3.fromRGB(34,94,93) or panelColor
            end
            for path,row in pairs(profileRows) do if not saved[path] then row:Destroy(); profileRows[path]=nil end end
            profiles.CanvasSize=UDim2.fromOffset(0,#E.savedProfiles*38)
            hook.Text=E.webhook.enabled and "WEBHOOK: ON" or "WEBHOOK: OFF"
            hookStatus.Text=E.webhookStatus
            local live={}
            local players=Players:GetPlayers()
            table.sort(players,function(a,b) return a.Name:lower()<b.Name:lower() end)
            for index,player in ipairs(players) do
                local id=player.UserId
                live[id]=true
                if not rows[id] then
                    local row=make("TextButton",{Size=UDim2.new(1,-10,0,34),TextSize=12,Font=Enum.Font.Gotham,
                        TextColor3=Color3.new(1,1,1),BorderSizePixel=0},roster)
                    connect(row.Activated,function() E.selectRecipient(id) end)
                    rows[id]=row
                end
                rows[id].LayoutOrder=index
                rows[id].Text=player.DisplayName.." (@"..player.Name..")"..(id==snap.hunter and " · HUNTER" or "")
                rows[id].BackgroundColor3=id==E.options.recipient and Color3.fromRGB(34,94,93) or panelColor
            end
            for id,row in pairs(rows) do if not live[id] then row:Destroy(); rows[id]=nil end end
            roster.CanvasSize=UDim2.fromOffset(0,#players*38)
        end
        task.spawn(function()
            while alive and not destroyed and ScreenGui.Parent do
                local ok=pcall(refresh)
                if not ok then E.status="Panel refresh interrupted; retrying." end
                task.wait(0.5)
            end
        end)
    end)()

    local heights={Team=900,Controls=1000,Safety=550,["Give Bounty"]=630,Settings=1190}
    local function setTab(tab)
        currentTab=tab
        for name,objects in pairs(groups) do
            for _,obj in ipairs(objects) do obj.Visible=name==tab end
        end
        for name,button in pairs(tabs) do
            button.BackgroundColor3=name==tab and Color3.fromRGB(34,75,77) or panelColor
            button.TextColor3=name==tab and accent or Color3.fromRGB(185,199,214)
        end
        Body.CanvasSize=UDim2.fromOffset(0,heights[tab])
        if E.refreshServerFallback then E.refreshServerFallback() end
        Body.CanvasPosition=Vector2.zero
    end
    for index,name in ipairs({"Team","Controls","Safety","Give Bounty","Settings"}) do
        local button=make("TextButton",{Text=name:upper(),Size=UDim2.new(1/5,-6,1,0),Position=UDim2.new((index-1)/5,3,0,0),
            Font=Enum.Font.GothamBold,TextSize=12,BorderSizePixel=0},nav)
        round(button); tabs[name]=button
        connect(button.Activated,function() setTab(name) end)
    end
    setTab("Team")
    local afkEnabled=false
    local idleConnection=nil
    local actions=0
    local function disableAfk()
        afkEnabled=false
        if idleConnection then idleConnection:Disconnect(); idleConnection=nil end
        afkButton.Text="ANTI AFK: OFF"; afkButton.BackgroundColor3=panelColor
    end
    local function toggleAfk()
        if destroyed or not alive then return end
        if afkEnabled then disableAfk(); afkStatus.Text="Anti AFK disabled; idle connection disconnected."; return end
        afkEnabled=true
        afkButton.Text="ANTI AFK: ON"; afkButton.BackgroundColor3=Color3.fromRGB(34,94,93)
        afkStatus.Text="Enabled; waiting for the Roblox idle event."
        idleConnection=LocalPlayer.Idled:Connect(function()
            if not afkEnabled or destroyed or not alive then return end
            local ok,err=pcall(function()
                local virtualUser=game:GetService("VirtualUser")
                virtualUser:CaptureController()
                virtualUser:ClickButton2(Vector2.zero)
            end)
            if ok then
                actions+=1
                afkStatus.Text="Simulated activity " .. actions .. " times this session."
            else
                disableAfk()
                afkStatus.Text="Unavailable in this environment: " .. tostring(err):sub(1,130)
            end
        end)
    end
    connect(afkButton.Activated,toggleAfk)
    toggleAfk()
    E.getAFK=function() return afkEnabled end
    E.setAFK=function(value) if afkEnabled~=value then toggleAfk() end end
    local started=os.clock()
    local elapsed,frames=0,0
    local ping="--"
    local sample=0
    connect(RunService.RenderStepped,function(dt)
        if destroyed or not alive then return end
        frames+=1; elapsed+=dt
        if elapsed<1 then return end
        local fps=math.floor(frames/elapsed+0.5)
        frames=0; elapsed=0; sample+=1
        if sample%3==1 then
            local ok,value=pcall(function() return LocalPlayer:GetNetworkPing()*1000 end)
            ping=ok and type(value)=="number" and tostring(math.floor(value+0.5)) or "--"
        end
        local seconds=math.floor(os.clock()-started)
        local duration=string.format("%02d:%02d:%02d",math.floor(seconds/3600),math.floor(seconds/60)%60,seconds%60)
        footer.Text=duration .. "  |  " .. fps .. " FPS  |  Ping: " .. ping .. " ms  |  AFK: " .. (afkEnabled and "ON" or "OFF") .. "  |  ALT: minimize"
    end)
    connect(Main:GetPropertyChangedSignal("Size"),function()
        nav.Visible=not minimized; footer.Visible=not minimized
    end)
    connect(ScreenGui.Destroying,function()
        alive=false; disableAfk()
        for _,c in ipairs(connections) do c:Disconnect() end
    end)
end)()

end
]====]
local ok, failure = xpcall(function()
    assert(type(loadstring) == "function", "This environment does not provide loadstring")
    report("Compiling script...")
    local chunk, compileError = loadstring(source, "AutofarmMain")
    assert(chunk, compileError)
    local run = chunk()
    report("Initializing controls...")
    run(report)
end, function(message)
    return debug.traceback(tostring(message), 2)
end)
if ok then
    gui:Destroy()
else
    label.TextColor3 = Color3.fromRGB(255, 160, 160)
    report("STARTUP ERROR\n" .. tostring(failure))
    warn("AUTOFARM startup failed: " .. tostring(failure))
end

Features & Information

i think it only works on madium, potassium,Synapse Z, and volt if it doesnt work for you let me know NOW WITHOUT KEY just give a like if you like it "it was made with ia so change whatever you want" Im not sure if it still works so be careful
#alt farm#criminality#give bounty

Community Comments (9)

patrolekw1patrolekw1Sep 19, 2026

yo bro after using it for a moment i found a bug. the accounts that teleport and then reset after getting hit (when farming in void) sometimes see the hunter on his original spawn and not in the void which stops the script and u have to manually reset all the accounts for it to work again.

Replying to @patrolekw1
carlitoskirkcarlitoskirkSep 19, 2026

@patrolekw1 You need a server with better ping so it barely happens

xu3wixu3wiSep 27, 2026

do you have discord server or smthn? i was wondering if you would sell keys for money like crypto?

Replying to @xu3wi
carlitoskirkcarlitoskirkSep 30, 2026

@xu3wi dont worry dude now its for free do whatever you want

etkkketkkkSep 27, 2026(edited)

fu@king work.ink

Replying to @etkkk
carlitoskirkcarlitoskirkSep 30, 2026

@etkkk now its for free dude

xu3wixu3wiSep 28, 2026

dawg this work ink blocking me sayin i got ad blocked which i dont just let me buy the key for crypto

Replying to @xu3wi
carlitoskirkcarlitoskirkSep 30, 2026

@xu3wi i give it to you for free

charlielindkistcharlielindkistOct 12, 2026

It doesn't even work on Delta **** you

More Scripts for [⚙️] Criminality