-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local HttpService = game:GetService("HttpService") local SESSION_KEY = "__EnemyManager_AutoTP_AutoSummon_V2" local previous = rawget(_G, SESSION_KEY) local saved = nil if type(previous) == "table" then if type(previous.Snapshot) == "function" then local ok, result = pcall(previous.Snapshot) if ok then saved = result end end if type(previous.Stop) == "function" then pcall(previous.Stop) end end local session = {running = true, connections = {}} _G[SESSION_KEY] = session local function listen(signal, callback) local connection = signal:Connect(function(...) if session.running then callback(...) end end) table.insert(session.connections, connection) return connection end local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local enemiesFolder = workspace:WaitForChild("Enemies") local remotes = ReplicatedStorage:WaitForChild("Remotes") local settings = { heightAbove = 0.2, teleportDistance = 6, followSpeed = 40, summonFirstDelay = 0.1, summonRetry = 0.1, releaseRetry = 1.5, summonRange = 22, resultTimeout = 3, linkTpTarget = true } local toggleKey = Enum.KeyCode.C local SETTINGS_FIELDS = { {key = "heightAbove", name = "Height above target", min = 0, max = 25, fmt = "%.1f", tip = "Studs (your preset: 8)"}, {key = "teleportDistance", name = "Teleport if farther than", min = 1, max = 100, fmt = "%.1f", tip = "Studs; otherwise follow"}, {key = "followSpeed", name = "Close-range follow speed", min = 5, max = 100, fmt = "%.0f", tip = "Higher = faster"}, {key = "summonFirstDelay", name = "First summon attempt delay", min = 0, max = 5, fmt = "%.2f", tip = "Seconds (your preset: 0.08)"}, {key = "summonRetry", name = "Summon retry cooldown", min = 0.05, max = 5, fmt = "%.2f", tip = "Seconds after server response"}, {key = "releaseRetry", name = "Release retry cooldown", min = 0.2, max = 5, fmt = "%.2f", tip = "Seconds between release requests; default 1.5"}, {key = "summonRange", name = "Summon base range", min = 5, max = 100, fmt = "%.1f", tip = "Game default 22 + spirit-size allowance"}, {key = "resultTimeout", name = "Summon response timeout", min = 1, max = 10, fmt = "%.1f", tip = "Retry if result event never arrives"} } local function parseKey(text) local wanted = tostring(text or ""):gsub("%s+", ""):lower() if wanted == "" then return nil end for _, key in ipairs(Enum.KeyCode:GetEnumItems()) do if key ~= Enum.KeyCode.Unknown and key.Name:lower() == wanted then return key end end return nil end if type(saved) == "table" and type(saved.settings) == "table" then for _, field in ipairs(SETTINGS_FIELDS) do local num = tonumber(saved.settings[field.key]) if num and num == num then settings[field.key] = math.clamp(num, field.min, field.max) end end if type(saved.settings.linkTpTarget) == "boolean" then settings.linkTpTarget = saved.settings.linkTpTarget end local parsed = parseKey(saved.settings.toggleKey) if parsed then toggleKey = parsed end if (saved.schemaVersion or 0) < 4 then settings.heightAbove = 1 settings.summonRange = 22 end end local whitelist = (type(saved) == "table" and type(saved.whitelist) == "table") and saved.whitelist or {} local selectedLandName = type(saved) == "table" and saved.selectedLandName or nil local selectedLand = nil local autoTP, autoSummon, autoRelease, autoTarget = false, false, false, false local autoTargetFromTP = false local setAutoTP local currentEnemy, currentSpirit = nil, nil local manualTarget = nil local automaticTarget = nil local lastTargetSent = nil local lastAutoTargetSent, lastAutoTargetSentAt = nil, -math.huge local pickManualTarget = false local spirits = {} local lastGlobalAttempt = -math.huge local runningStatus = "Choose a land and whitelist enemy types" local gui local COORDS_FILE = "EnemyManager_LandCoordinates_v1.json" local COORDS_CACHE_KEY = "__EnemyManager_LandCoordinates_v1" local landCoords = {} local pendingServerWrites = {} local coordRemote = nil local render local function cleanPoint(value) if type(value) ~= "table" then return nil end local x = tonumber(value.x or value.X or value[1]) local y = tonumber(value.y or value.Y or value[2]) local z = tonumber(value.z or value.Z or value[3]) if not x or not y or not z then return nil end for _, n in ipairs({x, y, z}) do if n ~= n or math.abs(n) > 1000000 then return nil end end return {x = x, y = y, z = z} end local function loadPointTable(value, overwrite) if type(value) ~= "table" then return end for name, coords in pairs(value) do if type(name) == "string" and #name > 0 and #name <= 100 then local clean = cleanPoint(coords) if clean and (overwrite or not landCoords[name]) then landCoords[name] = clean end end end end if type(readfile) == "function" then local ok, json = pcall(readfile, COORDS_FILE) if ok and type(json) == "string" then local decodedOk, decoded = pcall(function() return HttpService:JSONDecode(json) end) if decodedOk and type(decoded) == "table" then loadPointTable(decoded.points or decoded, true) if type(decoded.preferences) == "table" and type(decoded.preferences.linkTpTarget) == "boolean" and not (type(saved) == "table" and type(saved.settings) == "table") then settings.linkTpTarget = decoded.preferences.linkTpTarget end end end end loadPointTable(rawget(_G, COORDS_CACHE_KEY), true) if type(saved) == "table" then loadPointTable(saved.landCoords, true) end _G[COORDS_CACHE_KEY] = landCoords local function saveCoordinateDisk() _G[COORDS_CACHE_KEY] = landCoords if type(writefile) ~= "function" then return false end local ok = pcall(function() writefile(COORDS_FILE, HttpService:JSONEncode({ version = 1, points = landCoords, preferences = {linkTpTarget = settings.linkTpTarget} })) end) return ok end local function saveCoordinateForLand(name, point) landCoords[name] = point pendingServerWrites[name] = true local diskSaved = saveCoordinateDisk() local serverAvailable = coordRemote and coordRemote:IsA("RemoteFunction") if serverAvailable then task.spawn(function() local ok, accepted = pcall(function() return coordRemote:InvokeServer("Save", name, point) end) if session.running and (not ok or not accepted) then warn("Enemy Manager: server coordinate save failed for", name) end end) end return diskSaved, serverAvailable end task.spawn(function() local candidate = ReplicatedStorage:WaitForChild("EnemyManagerLandCoordsRemote", 6) if not session.running or not candidate or not candidate:IsA("RemoteFunction") then return end coordRemote = candidate local ok, savedPoints = pcall(function() return candidate:InvokeServer("Load") end) if ok and type(savedPoints) == "table" and session.running then for name, point in pairs(savedPoints) do if not pendingServerWrites[name] then loadPointTable({[name] = point}, true) end end saveCoordinateDisk() if render then render() end end end) local function snapshot() local whitelistCopy = {} for landName, names in pairs(whitelist) do whitelistCopy[landName] = {} for name, enabled in pairs(names) do if enabled then whitelistCopy[landName][name] = true end end end local settingsCopy = {} for key, value in pairs(settings) do settingsCopy[key] = value end settingsCopy.toggleKey = toggleKey.Name return { schemaVersion = 7, landCoords = landCoords, whitelist = whitelistCopy, settings = settingsCopy, selectedLandName = selectedLand and selectedLand.Name or selectedLandName } end session.Snapshot = snapshot local function stop() if not session.running then return end session.running = false saveCoordinateDisk() autoTP, autoSummon, autoRelease, autoTarget = false, false, false, false currentEnemy, currentSpirit, manualTarget, automaticTarget = nil, nil, nil, nil pickManualTarget = false for _, connection in ipairs(session.connections) do connection:Disconnect() end table.clear(session.connections) if gui then local oldGui = gui gui = nil oldGui:Destroy() end if rawget(_G, SESSION_KEY) == session then _G[SESSION_KEY] = nil end end session.Stop = stop local priorGui = playerGui:FindFirstChild("EnemyManagerGUI") if priorGui then priorGui:Destroy() end local C = { bg = Color3.fromRGB(16, 23, 34), panel = Color3.fromRGB(29, 41, 57), button = Color3.fromRGB(41, 55, 73), selected = Color3.fromRGB(36, 87, 163), green = Color3.fromRGB(32, 125, 90), red = Color3.fromRGB(140, 55, 55), text = Color3.fromRGB(241, 245, 249), muted = Color3.fromRGB(148, 163, 184) } local function new(class, parent, properties) local obj = Instance.new(class) for key, value in pairs(properties or {}) do obj[key] = value end obj.Parent = parent return obj end local function rounded(obj, radius) new("UICorner", obj, {CornerRadius = UDim.new(0, radius or 8)}) return obj end local function remote(name) local item = remotes:FindFirstChild(name, true) if not item then item = remotes:WaitForChild(name, 5) end if item and item:IsA("RemoteEvent") then return item end warn("Enemy Manager: missing RemoteEvent", name) return nil end local setTargetRemote = remote("SetTarget") local attemptRemote = remote("SummonAttempt") local releaseRemote = remote("ReleaseSpirit") local availableRemote = remote("SpiritAvailable") local resultRemote = remote("SummonResult") local removedRemote = remote("SpiritRemoved") local summonSupported = attemptRemote ~= nil and availableRemote ~= nil and resultRemote ~= nil and removedRemote ~= nil local releaseSupported = releaseRemote ~= nil and availableRemote ~= nil and removedRemote ~= nil local DEFAULT_ATTEMPTS = 3 local DEFAULT_SPIRIT_LIFETIME = 15 pcall(function() local shared = ReplicatedStorage:FindFirstChild("Shared") local config = shared and shared:FindFirstChild("Config") local module = config and config:FindFirstChild("Summon") if module then local summoning = require(module) DEFAULT_ATTEMPTS = tonumber(summoning.Attempts) or DEFAULT_ATTEMPTS DEFAULT_SPIRIT_LIFETIME = tonumber(summoning.SpiritLifetime) or DEFAULT_SPIRIT_LIFETIME local range = tonumber(summoning.InteractRange) if range and (not saved or (saved.schemaVersion or 0) < 4) then settings.summonRange = math.clamp(range, 5, 100) end end end) gui = new("ScreenGui", playerGui, { Name = "EnemyManagerGUI", ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling }) local main = new("Frame", gui, { Name = "Main", AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.fromScale(0.82, 0.88), BackgroundColor3 = C.bg, BorderSizePixel = 0 }) rounded(main, 12) new("UISizeConstraint", main, { MinSize = Vector2.new(320, 480), MaxSize = Vector2.new(700, 690) }) new("TextLabel", main, { BackgroundTransparency = 1, Position = UDim2.fromOffset(14, 9), Size = UDim2.new(1, -118, 0, 29), Font = Enum.Font.GothamBold, TextSize = 20, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left, Text = "Enemy Manager" }) local hotkeyHint = new("TextLabel", main, { BackgroundTransparency = 1, Position = UDim2.fromOffset(14, 41), Size = UDim2.new(1, -28, 0, 20), Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, Text = "C: show / hide | X: stop script" }) local function updateHotkeyHint() hotkeyHint.Text = toggleKey.Name .. ": show / hide | X: stop script" end updateHotkeyHint() local hideButton = rounded(new("TextButton", main, { Position = UDim2.new(1, -81, 0, 10), Size = UDim2.fromOffset(28, 28), Font = Enum.Font.GothamBold, TextSize = 16, TextColor3 = C.text, BackgroundColor3 = C.button, BorderSizePixel = 0, Text = "_" }), 7) local closeButton = rounded(new("TextButton", main, { Position = UDim2.new(1, -43, 0, 10), Size = UDim2.fromOffset(28, 28), Font = Enum.Font.GothamBold, TextSize = 15, TextColor3 = C.text, BackgroundColor3 = C.red, BorderSizePixel = 0, Text = "X" }), 7) local showButton = rounded(new("TextButton", gui, { Position = UDim2.new(0, 12, 0.5, -20), Size = UDim2.fromOffset(64, 40), BackgroundColor3 = C.selected, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 15, TextColor3 = C.text, Text = "EM", Visible = false }), 8) local function setGuiVisible(visible) main.Visible = visible showButton.Visible = not visible end listen(hideButton.MouseButton1Click, function() setGuiVisible(false) end) listen(showButton.MouseButton1Click, function() setGuiVisible(true) end) listen(closeButton.MouseButton1Click, stop) listen(gui.Destroying, stop) listen(UserInputService.InputBegan, function(input, gameProcessed) if input.KeyCode == toggleKey and not UserInputService:GetFocusedTextBox() then setGuiVisible(not main.Visible) end end) local body = new("Frame", main, { BackgroundTransparency = 1, Position = UDim2.new(0, 14, 0, 70), Size = UDim2.new(1, -28, 1, -332) }) local function makePanel(title, position, size) local holder = rounded(new("Frame", body, { Position = position, Size = size, BackgroundColor3 = C.panel, BorderSizePixel = 0 }), 9) new("TextLabel", holder, { Position = UDim2.fromOffset(10, 6), Size = UDim2.new(1, -20, 0, 28), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = 14, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left, Text = title }) local scroll = new("ScrollingFrame", holder, { Position = UDim2.new(0, 8, 0, 39), Size = UDim2.new(1, -16, 1, -47), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 3, CanvasSize = UDim2.fromOffset(0, 0), AutomaticCanvasSize = Enum.AutomaticSize.Y }) new("UIListLayout", scroll, { Padding = UDim.new(0, 6), SortOrder = Enum.SortOrder.LayoutOrder }) return scroll end local landList = makePanel("Lands", UDim2.fromScale(0, 0), UDim2.new(0.4, -5, 1, 0)) local enemyList = makePanel("Enemy Whitelist", UDim2.new(0.4, 5, 0, 0), UDim2.new(0.6, -5, 1, 0)) local function makeToggle(y, title) return rounded(new("TextButton", main, { Position = UDim2.new(0, 14, 1, y), Size = UDim2.new(1, -28, 0, 36), BorderSizePixel = 0, BackgroundColor3 = C.red, Font = Enum.Font.GothamBold, TextSize = 14, TextColor3 = C.text, Text = title .. ": OFF" }), 8) end local tpButton = makeToggle(-214, "Auto TP") tpButton.Size = UDim2.new(1, -155, 0, 36) local linkButton = rounded(new("TextButton", main, { Position = UDim2.new(1, -137, 1, -214), Size = UDim2.fromOffset(123, 36), BackgroundColor3 = C.button, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 11, TextColor3 = C.text, Text = "TP > Target: ON" }), 7) local summonButton = makeToggle(-173, "Auto Summon") summonButton.Size = UDim2.new(0.5, -17, 0, 36) local releaseButton = rounded(new("TextButton", main, { Position = UDim2.new(0.5, 3, 1, -173), Size = UDim2.new(0.5, -17, 0, 36), BackgroundColor3 = C.red, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 13, TextColor3 = C.text, Text = "Auto Release: OFF" }), 8) local targetButton = makeToggle(-132, "Auto SetTarget") local pickButton = rounded(new("TextButton", main, { Position = UDim2.new(0, 14, 1, -254), Size = UDim2.new(0.61, -17, 0, 34), BackgroundColor3 = C.button, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 12, TextColor3 = C.text, Text = "Pick target (click enemy)" }), 7) local clearPriorityButton = rounded(new("TextButton", main, { Position = UDim2.new(0.61, 3, 1, -254), Size = UDim2.new(0.39, -17, 0, 34), BackgroundColor3 = C.button, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 12, TextColor3 = C.text, Text = "Clear priority" }), 7) local settingsButton = rounded(new("TextButton", main, { Position = UDim2.new(0, 14, 1, -92), Size = UDim2.new(1, -28, 0, 36), BackgroundColor3 = C.button, BorderSizePixel = 0, Font = Enum.Font.GothamBold, TextSize = 13, TextColor3 = C.text, Text = "Settings >" }), 8) local status = new("TextLabel", main, { Position = UDim2.new(0, 14, 1, -41), Size = UDim2.new(1, -28, 0, 28), BackgroundTransparency = 1, Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = C.muted, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd, Text = runningStatus }) local function setStatus(text) runningStatus = text if status and status.Parent then status.Text = text end end local editorLandName = nil local editorShade = new("Frame", main, { Size = UDim2.fromScale(1, 1), BackgroundColor3 = Color3.new(0, 0, 0), BackgroundTransparency = 0.38, BorderSizePixel = 0, Visible = false, Active = true, ZIndex = 15 }) local editor = rounded(new("Frame", main, { AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.fromScale(0.5, 0.5), Size = UDim2.new(1, -40, 0, 185), BackgroundColor3 = C.panel, BorderSizePixel = 0, Visible = false, Active = true, ZIndex = 16 }), 10) new("UIStroke", editor, {Color = C.selected, Thickness = 1, Transparency = 0.25}) local editorTitle = new("TextLabel", editor, { Position = UDim2.fromOffset(12, 9), Size = UDim2.new(1, -24, 0, 24), BackgroundTransparency = 1, Font = Enum.Font.GothamBold, TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left, TextColor3 = C.text, Text = "Land teleport coordinates", ZIndex = 17 }) local coordBoxes = {} for index, axis in ipairs({"X", "Y", "Z"}) do local slot = new("Frame", editor, { Position = UDim2.new((index - 1) / 3, 10, 0, 44), Size = UDim2.new(1 / 3, -17, 0, 53), BackgroundTransparency = 1, ZIndex = 17 }) new("TextLabel", slot, { Size = UDim2.new(1, 0, 0, 18), BackgroundTransparency = 1, Text = axis, Font = Enum.Font.GothamMedium, TextSize = 12, TextColor3 = C.muted, ZIndex = 18 }) local box = rounded(new("TextBox", slot, { Position = UDim2.fromOffset(0, 19), Size = UDim2.new(1, 0, 0, 31), BackgroundColor3 = C.button, BorderSizePixel = 0, Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = C.text, Text = "0", ClearTextOnFocus = false, PlaceholderText = "0", ZIndex = 18 }), 6) coordBoxes[index] = box end local editorUseHere = rounded(new("TextButton", editor, { Position = UDim2.new(0, 10, 0, 108), Size = UDim2.new(1, -20, 0, 27), BackgroundColor3 = C.button, BorderSizePixel = 0, TextColor3 = C.text, Text = "Use my current position", Font = Enum.Font.Gotham, TextSize = 12, ZIndex = 17 }), 6) local editorCancel = rounded(new("TextButton", editor, { Position = UDim2.new(0, 10, 0, 146), Size = UDim2.new(0.5, -15, 0, 28), BackgroundColor3 = C.button, BorderSizePixel = 0, TextColor3 = C.text, Text = "Cancel", Font = Enum.Font.GothamBold, TextSize = 12, ZIndex = 17 }), 6) local editorSave = rounded(new("TextButton", editor, { Position = UDim2.new(0.5, 5, 0, 146), Size = UDim2.new(0.5, -15, 0, 28), BackgroundColor3 = C.green, BorderSizePixel = 0, TextColor3 = C.text, Text = "Save coordinates", Font = Enum.Font.GothamBold, TextSize = 12, ZIndex = 17 }), 6) local function closeCoordinateEditor() editor.Visible = false editorShade.Visible = false editorLandName = nil end local function fillCoordinateBoxes(point) local numbers = {point.x, point.y, point.z} for i = 1, 3 do coordBoxes[i].Text = string.format("%.2f", numbers[i]) end end local function openCoordinateEditor(landName) editorLandName = landName editorTitle.Text = "Teleport: " .. landName .. " (X / Y / Z)" editorTitle.TextColor3 = C.text local point = landCoords[landName] if not point then local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") local v = root and root.Position or Vector3.zero point = {x = v.X, y = v.Y, z = v.Z} end fillCoordinateBoxes(point) editorShade.Visible = true editor.Visible = true end listen(editorUseHere.MouseButton1Click, function() local char = player.Character local root = char and char:FindFirstChild("HumanoidRootPart") if not root then setStatus("Character not available for current position") return end local v = root.Position fillCoordinateBoxes({x = v.X, y = v.Y, z = v.Z}) end) listen(editorCancel.MouseButton1Click, closeCoordinateEditor) listen(editorSave.MouseButton1Click, function() if not editorLandName then return end local point = cleanPoint({ x = coordBoxes[1].Text, y = coordBoxes[2].Text, z = coordBoxes[3].Text }) if not point then editorTitle.Text = "Invalid coordinates — enter X, Y and Z" editorTitle.TextColor3 = C.red setStatus("Enter valid numeric X, Y and Z values") return end local name = editorLandName local diskSaved, serverAvailable = saveCoordinateForLand(name, point) closeCoordinateEditor() if render then render() end if diskSaved or serverAvailable then setStatus("Saved teleport for " .. name .. " (persistent storage requested)") else setStatus("Saved " .. name .. " for this session; persistent storage unavailable") end end) local settingsPanel = rounded(new("Frame", main, { Position = UDim2.new(0, 14, 0, 71), Size = UDim2.new(1, -28, 1, -125), BackgroundColor3 = C.panel, BorderSizePixel = 0, Visible = false }), 9) local backButton = rounded(new("TextButton", settingsPanel, { Position = UDim2.fromOffset(9, 8), Size = UDim2.fromOffset(80, 30), BackgroundColor3 = C.button, BorderSizePixel = 0, TextColor3 = C.text, Font = Enum.Font.GothamBold, TextSize = 13, Text = "< Back" }), 7) new("TextLabel", settingsPanel, { Position = UDim2.fromOffset(102, 8), Size = UDim2.new(1, -111, 0, 30), BackgroundTransparency = 1, Text = "Controls & Summon", Font = Enum.Font.GothamBold, TextSize = 14, TextColor3 = C.text, TextXAlignment = Enum.TextXAlignment.Left }) local settingsScroll = new("ScrollingFrame", settingsPanel, { Position = UDim2.new(0, 10, 0, 46), Size = UDim2.new(1, -20, 1, -55), BackgroundTransparency = 1, BorderSizePixel = 0, ScrollBarThickness = 3, CanvasSize = UDim2.fromOffset(0, 0), AutomaticCanvasSize = Enum.AutomaticSize.Y }) new("UIListLayout", settingsScroll, { Padding = UDim.new(0, 7), SortOrder = Enum.SortOrder.LayoutOrder }) local function openSettings(open) settingsPanel.Visible = open body.Visible = not open tpButton.Visible = not open linkButton.Visible = not open if open then closeCoordinateEditor() end summonButton.Visible = not open releaseButton.Visible = not open targetButton.Visible = not open pickButton.Visible = not open clearPriorityButton.Visible = not open settingsButton.Visible = not open end listen(settingsButton.MouseButton1Click, function() openSettings(true) end) listen(backButton.MouseButton1Click, function() openSettings(false) end) local keyRow = rounded(new("Frame", settingsScroll, { Size = UDim2.new(1, -5, 0, 54), LayoutOrder = 1, BackgroundColor3 = C.button, BorderSizePixel = 0 }), 7) new("TextLabel", keyRow, { Position = UDim2.fromOffset(9, 5), Size = UDim2.new(1, -108, 0, 22), BackgroundTransparency = 1, Text = "GUI toggle key", TextColor3 = C.text, Font = Enum.Font.GothamMedium, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Left }) new("TextLabel", keyRow, { Position = UDim2.fromOffset(9, 28), Size = UDim2.new(1, -108, 0, 18), BackgroundTransparency = 1, Text = "Default: C | e.g. V, F4, RightShift", TextColor3 = C.muted, Font = Enum.Font.Gotham, TextSize = 10, TextXAlignment = Enum.TextXAlignment.Left }) local keyBox = rounded(new("TextBox", keyRow, { AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -7, 0.5, 0), Size = UDim2.fromOffset(88, 33), BackgroundColor3 = C.panel, BorderSizePixel = 0, TextColor3 = C.text, Font = Enum.Font.GothamBold, TextSize = 13, ClearTextOnFocus = false, Text = toggleKey.Name }), 6) listen(keyBox.FocusLost, function() local parsed = parseKey(keyBox.Text) if parsed then toggleKey = parsed updateHotkeyHint() setStatus("GUI toggle key set to " .. toggleKey.Name) else setStatus("Invalid key; keeping " .. toggleKey.Name) end keyBox.Text = toggleKey.Name end) for order, field in ipairs(SETTINGS_FIELDS) do local row = rounded(new("Frame", settingsScroll, { Size = UDim2.new(1, -5, 0, 54), LayoutOrder = order + 1, BackgroundColor3 = C.button, BorderSizePixel = 0 }), 7) new("TextLabel", row, { Position = UDim2.fromOffset(9, 5), Size = UDim2.new(1, -108, 0, 22), BackgroundTransparency = 1, Text = field.name, TextColor3 = C.text, Font = Enum.Font.GothamMedium, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Left }) new("TextLabel", row, { Position = UDim2.fromOffset(9, 28), Size = UDim2.new(1, -108, 0, 18), BackgroundTransparency = 1, Text = field.tip, TextColor3 = C.muted, Font = Enum.Font.Gotham, TextSize = 10, TextXAlignment = Enum.TextXAlignment.Left }) local box = rounded(new("TextBox", row, { AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -7, 0.5, 0), Size = UDim2.fromOffset(88, 33), BackgroundColor3 = C.panel, BorderSizePixel = 0, TextColor3 = C.text, Font = Enum.Font.GothamBold, TextSize = 13, ClearTextOnFocus = false, Text = string.format(field.fmt, settings[field.key]) }), 6) listen(box.FocusLost, function() local val = tonumber(box.Text) if val and val == val then settings[field.key] = math.clamp(val, field.min, field.max) setStatus(field.name .. " saved") else setStatus("Invalid number for " .. field.name) end box.Text = string.format(field.fmt, settings[field.key]) end) end local function getWhitelist(land) if not land then return nil end local name = typeof(land) == "Instance" and land.Name or land whitelist[name] = whitelist[name] or {} return whitelist[name] end local function playerRoot() local char = player.Character local hum = char and char:FindFirstChildOfClass("Humanoid") if not hum or hum.Health <= 0 then return nil end return char:FindFirstChild("HumanoidRootPart") end local function modelRoot(model) if not model or not model.Parent then return nil end local root = model:FindFirstChild("HumanoidRootPart") or model.PrimaryPart return root or model:FindFirstChildWhichIsA("BasePart", true) end local function enemyEligible(model) if not model or not selectedLand or model.Parent ~= selectedLand then return false end if not getWhitelist(selectedLand)[model.Name] then return false end local hum = model:FindFirstChildOfClass("Humanoid") return hum ~= nil and hum.Health > 0 and modelRoot(model) ~= nil end local function normalize(name) if type(name) ~= "string" then return "" end return (name:match("^([^,]+)") or name):lower():gsub("%s+", "") end local function findSpiritModel(sp) if typeof(sp.model) == "Instance" and sp.model.Parent then return sp.model end local now = os.clock() if now - (sp.lastModelLookup or -math.huge) < 0.25 then return nil end sp.lastModelLookup = now local folder = workspace:FindFirstChild("Spirits") if folder then for _, child in ipairs(folder:GetChildren()) do if child:GetAttribute("SpiritId") == sp.id then sp.model = child return child end end end return nil end local function spiritPosition(sp) if not sp then return nil end local model = findSpiritModel(sp) if model then if model:IsA("BasePart") then return model.Position end if model:IsA("Model") then local root = modelRoot(model) if root then return root.Position end end end local payload = sp.payload or {} return typeof(payload.Position) == "Vector3" and payload.Position or nil end local function spiritEligible(sp, forRelease) if not sp or not selectedLand then return false end local payload = sp.payload or {} if forRelease then if payload.FirstTame == true or payload.NoRelease == true then return false end elseif sp.blocked or (sp.attempts or 0) <= 0 then return false end if sp.expiresAt and workspace:GetServerTimeNow() >= sp.expiresAt then return false end if not spiritPosition(sp) then return false end if type(payload.Land) == "string" and payload.Land ~= selectedLand.Name then return false end local candidates = {payload.Species or "", payload.DisplayName or ""} if sp.model then table.insert(candidates, sp.model.Name) end for enemyName, enabled in pairs(getWhitelist(selectedLand)) do if enabled then for _, candidate in ipairs(candidates) do if normalize(enemyName) == normalize(candidate) then return true end end end end return false end local SPIRIT_SWITCH_MARGIN = 2 local function closestSpirit(root, forRelease) if not root then return nil end if currentSpirit and spiritEligible(currentSpirit, forRelease) then local now = os.clock() if (not forRelease and currentSpirit.waiting and now - (currentSpirit.lastSent or now) < settings.resultTimeout) or (forRelease and now < (currentSpirit.nextReleaseAt or 0)) then return currentSpirit end end local best, bestDist = nil, math.huge for _, sp in pairs(spirits) do if spiritEligible(sp, forRelease) then local pos = spiritPosition(sp) if pos then local dist = (root.Position - pos).Magnitude if dist < bestDist then best, bestDist = sp, dist end end end end if currentSpirit and best and currentSpirit ~= best and spiritEligible(currentSpirit, forRelease) then local currentPos = spiritPosition(currentSpirit) if currentPos and (root.Position - currentPos).Magnitude <= bestDist + SPIRIT_SWITCH_MARGIN then return currentSpirit end end return best end local function summonReach(sp) local model = findSpiritModel(sp) local radius = 0 if model and model:IsA("Model") then local attrRadius = tonumber(model:GetAttribute("Radius")) if attrRadius and attrRadius > 0 then radius = attrRadius else local ok, _, size = pcall(function() return model:GetBoundingBox() end) if ok and size then radius = math.max(size.X, size.Z) * 0.5 end end elseif model and model:IsA("BasePart") then radius = math.max(model.Size.X, model.Size.Z) * 0.5 end return settings.summonRange + radius * 0.6 end local function targetDestination(enemy) local root = modelRoot(enemy) return root and root.Position + Vector3.new(0, settings.heightAbove, 0) or nil end local function closestEnemy(root) if not selectedLand then return nil end local best, bestDistance = nil, math.huge for _, enemy in ipairs(selectedLand:GetChildren()) do if enemy:IsA("Model") and enemyEligible(enemy) then local pos = targetDestination(enemy) if pos then local distance = (root.Position - pos).Magnitude if distance < bestDistance then best, bestDistance = enemy, distance end end end end return best end local function liveEnemyAnywhere(enemy) if typeof(enemy) ~= "Instance" or not enemy:IsA("Model") then return false end local land = enemy.Parent if not land or land.Parent ~= enemiesFolder then return false end local hum = enemy:FindFirstChildOfClass("Humanoid") return hum ~= nil and hum.Health > 0 and modelRoot(enemy) ~= nil end local function closestEnemyAnywhere(root) local best, bestDistance = nil, math.huge for _, land in ipairs(enemiesFolder:GetChildren()) do if land:IsA("Folder") then for _, enemy in ipairs(land:GetChildren()) do if liveEnemyAnywhere(enemy) then local enemyRoot = modelRoot(enemy) local distance = (root.Position - enemyRoot.Position).Magnitude if distance < bestDistance then best, bestDistance = enemy, distance end end end end end return best end local function resolveEnemy(value) if typeof(value) == "Instance" then local obj = value while obj and obj ~= enemiesFolder do if obj:IsA("Model") and obj.Parent and obj.Parent.Parent == enemiesFolder then return obj end obj = obj.Parent end elseif type(value) == "table" then for _, field in ipairs({"Model", "Enemy", "Target", "target", "Instance"}) do local model = resolveEnemy(value[field]) if model then return model end end end return nil end local function sendTarget(enemy, fromAuto) if not setTargetRemote or not liveEnemyAnywhere(enemy) then return false end if lastTargetSent == enemy then return true end lastTargetSent = enemy if fromAuto then lastAutoTargetSent = enemy lastAutoTargetSentAt = os.clock() end setTargetRemote:FireServer(enemy) return true end local function setManualPriority(candidate, alreadySent) local enemy = resolveEnemy(candidate) if not liveEnemyAnywhere(enemy) then return false end manualTarget = enemy automaticTarget = nil pickManualTarget = false if not alreadySent then lastTargetSent = nil sendTarget(enemy, false) else lastTargetSent = enemy end pickButton.Text = "Priority: " .. enemy.Name .. " (change)" pickButton.BackgroundColor3 = C.selected setStatus("Manual priority: " .. enemy.Name .. " (until defeated or changed)") return true end local manualTargetBridge = new("BindableEvent", gui, { Name = "ManualTargetSelected" }) listen(manualTargetBridge.Event, function(enemy) setManualPriority(enemy, true) end) task.spawn(function() local scripts = player:FindFirstChild("PlayerScripts") local client = scripts and scripts:FindFirstChild("Client") local stateModule = client and client:FindFirstChild("ClientState") if not stateModule or not stateModule:IsA("ModuleScript") then return end local ok, state = pcall(require, stateModule) if not ok or type(state) ~= "table" or not session.running then return end local signal = state.TargetChanged if not signal and type(state.Signal) == "function" then local success, result = pcall(state.Signal, "TargetChanged") if success then signal = result end end if not signal then return end local connected, connection = pcall(function() return signal:Connect(function(...) if not session.running then return end for _, value in ipairs({...}) do local enemy = resolveEnemy(value) if liveEnemyAnywhere(enemy) then if enemy ~= lastAutoTargetSent or os.clock() - lastAutoTargetSentAt > 2 then setManualPriority(enemy, true) end return end end end) end) if connected and connection then if session.running then table.insert(session.connections, connection) else connection:Disconnect() end end end) local function approxSummonDistance(rootPos, spiritPos) local dx = rootPos.X - spiritPos.X local dz = rootPos.Z - spiritPos.Z return math.sqrt(dx * dx + dz * dz) end local function moveFloating(root, destination, deltaTime) if not destination then return end local char = player.Character if not char or not char.Parent or root.Parent ~= char then return end local offset = destination - root.Position local distance = offset.Magnitude if distance > 0.015 then local step if distance > settings.teleportDistance then step = offset else local t = math.clamp((deltaTime or 0.016) * settings.followSpeed, 0, 1) step = offset * (distance < 0.5 and 1 or t) end char:PivotTo(char:GetPivot() + step) end root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero end local function clearList(scroll) for _, child in ipairs(scroll:GetChildren()) do if child:IsA("GuiObject") then child:Destroy() end end end local function addButton(scroll, label, selected, callback) local btn = rounded(new("TextButton", scroll, { Size = UDim2.new(1, -4, 0, 38), BackgroundColor3 = selected and C.selected or C.button, BorderSizePixel = 0, Text = " " .. label, TextColor3 = C.text, TextSize = 12, Font = Enum.Font.GothamMedium, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd }), 7) btn.MouseButton1Click:Connect(function() if session.running then callback() end end) end render = function() if not session.running or not gui or not gui.Parent then return end clearList(landList) clearList(enemyList) local lands = {} for _, obj in ipairs(enemiesFolder:GetChildren()) do if obj:IsA("Folder") then table.insert(lands, obj) end end table.sort(lands, function(a, b) return a.Name:lower() < b.Name:lower() end) if not selectedLand or not table.find(lands, selectedLand) then selectedLand = nil for _, folder in ipairs(lands) do if folder.Name == selectedLandName then selectedLand = folder; break end end selectedLand = selectedLand or lands[1] selectedLandName = selectedLand and selectedLand.Name or nil currentEnemy, currentSpirit = nil, nil end for _, folder in ipairs(lands) do local hasCoords = landCoords[folder.Name] ~= nil local row = new("Frame", landList, { Size = UDim2.new(1, -4, 0, 38), BackgroundColor3 = folder == selectedLand and C.selected or C.button, BorderSizePixel = 0 }) rounded(row, 7) local selectLand = new("TextButton", row, { Position = UDim2.fromOffset(0, 0), Size = UDim2.new(1, -67, 1, 0), BackgroundTransparency = 1, Text = " " .. folder.Name, Font = Enum.Font.GothamMedium, TextSize = 12, TextXAlignment = Enum.TextXAlignment.Left, TextTruncate = Enum.TextTruncate.AtEnd, TextColor3 = C.text }) local tpLand = rounded(new("TextButton", row, { Position = UDim2.new(1, -65, 0.5, -13), Size = UDim2.fromOffset(35, 26), BackgroundColor3 = hasCoords and C.green or C.panel, BorderSizePixel = 0, Text = "TP", TextColor3 = C.text, Font = Enum.Font.GothamBold, TextSize = 11 }), 5) local editLand = rounded(new("TextButton", row, { Position = UDim2.new(1, -27, 0.5, -13), Size = UDim2.fromOffset(25, 26), BackgroundColor3 = C.panel, BorderSizePixel = 0, Text = "...", TextColor3 = C.muted, Font = Enum.Font.GothamBold, TextSize = 12 }), 5) selectLand.MouseButton1Click:Connect(function() if not session.running then return end if folder ~= selectedLand then selectedLand = folder selectedLandName = folder.Name currentEnemy, currentSpirit = nil, nil end render() end) editLand.MouseButton1Click:Connect(function() if session.running then openCoordinateEditor(folder.Name) end end) tpLand.MouseButton1Click:Connect(function() if not session.running then return end local point = landCoords[folder.Name] if not point then openCoordinateEditor(folder.Name) setStatus("Set coordinates for " .. folder.Name .. " once to enable land TP") return end local root = playerRoot() local char = player.Character if not root or not char then setStatus("Character unavailable for teleport") return end local wasAutoTP = autoTP if autoTP and setAutoTP then setAutoTP(false) end local dest = Vector3.new(point.x, point.y, point.z) char:PivotTo(char:GetPivot() + (dest - root.Position)) root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero selectedLand, selectedLandName = folder, folder.Name currentEnemy, currentSpirit = nil, nil render() setStatus("Teleported to " .. folder.Name .. (wasAutoTP and " (Auto TP turned OFF)" or "")) end) end if not selectedLand then setStatus("No land folders found in Workspace.Enemies") return end local counts, names = {}, {} for _, model in ipairs(selectedLand:GetChildren()) do if model:IsA("Model") then if not counts[model.Name] then counts[model.Name] = 0 table.insert(names, model.Name) end counts[model.Name] += 1 end end table.sort(names, function(a, b) return a:lower() < b:lower() end) local allowed = getWhitelist(selectedLand) for _, name in ipairs(names) do local checked = allowed[name] == true addButton(enemyList, (checked and "[X] " or "[ ] ") .. name .. " (" .. counts[name] .. ")", checked, function() allowed[name] = not checked if not enemyEligible(currentEnemy) then currentEnemy = nil end if not spiritEligible(currentSpirit, autoRelease) then currentSpirit = nil end render() end) end if #names == 0 then new("TextLabel", enemyList, { Size = UDim2.new(1, -4, 0, 45), BackgroundTransparency = 1, Text = "No enemies in this land", Font = Enum.Font.Gotham, TextSize = 12, TextColor3 = C.muted }) end end local function updateToggleButtons() linkButton.Text = "TP > Target: " .. (settings.linkTpTarget and "ON" or "OFF") linkButton.BackgroundColor3 = settings.linkTpTarget and C.selected or C.button tpButton.Text = "Auto TP: " .. (autoTP and "ON" or "OFF") tpButton.BackgroundColor3 = autoTP and C.green or C.red summonButton.Text = "Summon: " .. (autoSummon and "ON" or "OFF") summonButton.BackgroundColor3 = autoSummon and C.green or C.red releaseButton.Text = "Release: " .. (autoRelease and "ON" or "OFF") releaseButton.BackgroundColor3 = autoRelease and C.green or C.red targetButton.Text = "Auto SetTarget: " .. (autoTarget and "ON" or "OFF") targetButton.BackgroundColor3 = autoTarget and C.green or C.red end setAutoTP = function(enabled) if autoTP == enabled then return end autoTP = enabled currentEnemy = nil if enabled then if settings.linkTpTarget and not autoTarget and setTargetRemote then autoTarget = true autoTargetFromTP = true end elseif autoTargetFromTP then autoTarget = false autoTargetFromTP = false automaticTarget = nil end updateToggleButtons() setStatus("Auto TP " .. (autoTP and "enabled" or "disabled")) end listen(tpButton.MouseButton1Click, function() setAutoTP(not autoTP) end) listen(linkButton.MouseButton1Click, function() settings.linkTpTarget = not settings.linkTpTarget if not settings.linkTpTarget then if autoTargetFromTP then autoTarget, autoTargetFromTP = false, false automaticTarget = nil end elseif autoTP and not autoTarget and setTargetRemote then autoTarget, autoTargetFromTP = true, true end saveCoordinateDisk() updateToggleButtons() setStatus("TP > Target link " .. (settings.linkTpTarget and "enabled" or "disabled")) end) listen(summonButton.MouseButton1Click, function() if not summonSupported then setStatus("Summon remotes unavailable") return end local enabled = not autoSummon autoSummon = enabled if enabled then autoRelease = false end currentSpirit = nil updateToggleButtons() setStatus("Auto Summon " .. (enabled and "enabled" or "disabled")) end) listen(releaseButton.MouseButton1Click, function() if not releaseSupported then setStatus("ReleaseSpirit remote or spirit events unavailable") return end local enabled = not autoRelease autoRelease = enabled if enabled then autoSummon = false end currentSpirit = nil updateToggleButtons() setStatus("Auto Release " .. (enabled and "enabled" or "disabled")) end) listen(targetButton.MouseButton1Click, function() if not setTargetRemote then setStatus("SetTarget RemoteEvent unavailable") return end autoTarget = not autoTarget autoTargetFromTP = false if not autoTarget then automaticTarget = nil setStatus("Auto SetTarget disabled") else setStatus("Auto SetTarget enabled (manual priority wins)") end updateToggleButtons() end) listen(pickButton.MouseButton1Click, function() pickManualTarget = not pickManualTarget pickButton.Text = pickManualTarget and "Click an enemy in the world..." or (manualTarget and ("Priority: " .. manualTarget.Name .. " (change)") or "Pick target (click enemy)") pickButton.BackgroundColor3 = (pickManualTarget or manualTarget) and C.selected or C.button if pickManualTarget then setStatus("Click an enemy model to prioritize it") end end) listen(clearPriorityButton.MouseButton1Click, function() manualTarget = nil automaticTarget = nil lastTargetSent = nil pickManualTarget = false pickButton.Text = "Pick target (click enemy)" pickButton.BackgroundColor3 = C.button setStatus("Manual priority cleared") end) listen(UserInputService.InputBegan, function(input, processed) if not pickManualTarget or processed then return end if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end local hit = player:GetMouse().Target if hit and setManualPriority(hit, false) then else setStatus("Please click a living enemy model") end end) task.spawn(function() while session.running and gui and gui.Parent do if manualTarget and not liveEnemyAnywhere(manualTarget) then manualTarget = nil automaticTarget = nil lastTargetSent = nil pickButton.Text = "Pick target (click enemy)" pickButton.BackgroundColor3 = C.button end if autoTarget and setTargetRemote then local root = playerRoot() if root then if manualTarget then if lastTargetSent ~= manualTarget then sendTarget(manualTarget, false) end else automaticTarget = closestEnemyAnywhere(root) if automaticTarget then sendTarget(automaticTarget, true) end end end end task.wait(0.1) end end) local function relevantChange(obj) return (obj:IsA("Folder") and obj.Parent == enemiesFolder) or (obj:IsA("Model") and obj.Parent and obj.Parent.Parent == enemiesFolder) end listen(enemiesFolder.DescendantAdded, function(obj) if relevantChange(obj) then task.defer(function() if session.running then render() end end) end end) listen(enemiesFolder.DescendantRemoving, function(obj) if relevantChange(obj) then task.defer(function() if session.running then render() end end) end end) local function trySummon(sp) if not session.running or not autoSummon or not summonSupported then return false end if sp ~= currentSpirit or not spiritEligible(sp) then return false end local root = playerRoot() local pos = spiritPosition(sp) if not root or not pos then return false end if approxSummonDistance(root.Position, pos) > summonReach(sp) then return false end local now = os.clock() if sp.waiting then return false end if now < (sp.firstReadyAt or 0) then return false end if now < (sp.nextAllowedAt or 0) then return false end if now - lastGlobalAttempt < settings.summonRetry then return false end for _, other in pairs(spirits) do if other ~= sp and other.waiting then if now - (other.lastSent or now) < settings.resultTimeout then return false end other.waiting = false other.nextAllowedAt = now + settings.summonRetry end end sp.waiting = true sp.firstSent = true sp.lastSent = now lastGlobalAttempt = now attemptRemote:FireServer(sp.id) setStatus("Summoning " .. tostring(sp.payload.Species or sp.id) .. " | " .. tostring(sp.attempts) .. " tries") return true end local function tryRelease(sp) if not session.running or not autoRelease or not releaseSupported then return false end if sp ~= currentSpirit or not spiritEligible(sp, true) then return false end local root = playerRoot() local pos = spiritPosition(sp) if not root or not pos then return false end if approxSummonDistance(root.Position, pos) > summonReach(sp) then return false end local now = os.clock() if now < (sp.nextReleaseAt or 0) then return false end sp.nextReleaseAt = now + settings.releaseRetry releaseRemote:FireServer(sp.id) setStatus("Releasing " .. tostring(sp.payload.Species or sp.id) .. " | waiting for spirit to disappear") return true end if summonSupported or releaseSupported then listen(availableRemote.OnClientEvent, function(payload) if type(payload) ~= "table" or payload.SpiritId == nil then return end local id = payload.SpiritId local sp = spirits[id] if not sp then sp = {id = id, firstReadyAt = os.clock() + settings.summonFirstDelay} end sp.payload = payload if typeof(payload.Model) == "Instance" then sp.model = payload.Model end sp.attempts = tonumber(payload.AttemptsLeft) or sp.attempts or DEFAULT_ATTEMPTS sp.expiresAt = tonumber(payload.ExpiresAt) or sp.expiresAt or (workspace:GetServerTimeNow() + (tonumber(payload.Lifetime) or DEFAULT_SPIRIT_LIFETIME)) spirits[id] = sp if autoSummon or autoRelease then local root = playerRoot() if root then currentSpirit = closestSpirit(root, autoRelease) end if autoRelease then tryRelease(currentSpirit) else trySummon(currentSpirit) end end end) listen(removedRemote.OnClientEvent, function(id) spirits[id] = nil if currentSpirit and currentSpirit.id == id then currentSpirit = nil end end) if resultRemote then listen(resultRemote.OnClientEvent, function(result) if type(result) ~= "table" or result.SpiritId == nil then return end local sp = spirits[result.SpiritId] if not sp then return end sp.waiting = false local now = os.clock() local reason = result.Reason if reason == "Cooldown" then sp.nextAllowedAt = now + 1.5 elseif reason == "Busy" then sp.nextAllowedAt = now + 0.3 elseif reason == "TooFar" then sp.nextAllowedAt = now + 0.5 else sp.nextAllowedAt = now + settings.summonRetry end if result.AttemptsLeft ~= nil then sp.attempts = tonumber(result.AttemptsLeft) or sp.attempts elseif reason == "Failed" or reason == "Resisted" then sp.attempts = math.max(0, (sp.attempts or 0) - 1) end if result.Success then spirits[result.SpiritId] = nil if currentSpirit == sp then currentSpirit = nil end setStatus("Summon succeeded: " .. tostring(result.SpiritId)) return end if sp.attempts <= 0 or reason == "NoAttempts" or reason == "Expired" or reason == "Invalid" or reason == "NotEligible" or reason == "StorageFull" then sp.blocked = true end setStatus("Summon " .. tostring(sp.id) .. ": " .. tostring(reason or "Attempt complete") .. " | " .. tostring(sp.attempts) .. " left") end) end end local function seedSpiritFromModel(model) if not model or not model.Parent then return end local id = model:GetAttribute("SpiritId") local species = model:GetAttribute("Species") if id == nil or type(species) ~= "string" or species == "" then return end local sp = spirits[id] if not sp then sp = { id = id, payload = {SpiritId = id, Species = species}, model = model, attempts = tonumber(model:GetAttribute("AttemptsLeft")) or DEFAULT_ATTEMPTS, firstReadyAt = os.clock() + settings.summonFirstDelay, expiresAt = tonumber(model:GetAttribute("ExpiresAt")) or (workspace:GetServerTimeNow() + DEFAULT_SPIRIT_LIFETIME) } spirits[id] = sp else sp.model = model end end local spiritFolder = workspace:FindFirstChild("Spirits") if spiritFolder then for _, child in ipairs(spiritFolder:GetChildren()) do seedSpiritFromModel(child) end listen(spiritFolder.ChildAdded, function(model) seedSpiritFromModel(model) task.defer(function() if not autoSummon and not autoRelease then return end local root = playerRoot() if root then currentSpirit = closestSpirit(root, autoRelease) end if autoRelease then tryRelease(currentSpirit) else trySummon(currentSpirit) end end) end) end render() updateToggleButtons() listen(RunService.Heartbeat, function(deltaTime) if not autoTP then return end local root = playerRoot() if not root or not selectedLand then return end if autoSummon or autoRelease then currentSpirit = closestSpirit(root, autoRelease) else currentSpirit = nil end local focus = (autoSummon or autoRelease) and spiritEligible(currentSpirit, autoRelease) and currentSpirit or nil if focus then local pos = spiritPosition(focus) if pos then currentEnemy = nil moveFloating(root, pos + Vector3.new(0, settings.heightAbove, 0), deltaTime) return end end if not enemyEligible(currentEnemy) then currentEnemy = closestEnemy(root) end local goal = currentEnemy and targetDestination(currentEnemy) or nil if goal then moveFloating(root, goal, deltaTime) end end) task.spawn(function() while session.running and gui and gui.Parent do local root = playerRoot() if not root then if autoTP or autoSummon or autoRelease then setStatus("Waiting for character...") end task.wait(0.05) continue end if (autoSummon or autoRelease) and selectedLand then currentSpirit = closestSpirit(root, autoRelease) elseif not autoSummon and not autoRelease then currentSpirit = nil end if (autoSummon or autoRelease) and currentSpirit and spiritEligible(currentSpirit, autoRelease) then local sp = currentSpirit local pos = spiritPosition(sp) local distance = pos and approxSummonDistance(root.Position, pos) or math.huge local reach = summonReach(sp) local now = os.clock() if autoSummon and sp.waiting and now - (sp.lastSent or now) >= settings.resultTimeout then sp.waiting = false sp.nextAllowedAt = now + settings.summonRetry setStatus("No summon response; retrying " .. tostring(sp.id)) end if distance <= reach then if autoRelease then tryRelease(sp) else trySummon(sp) end else if autoTP then setStatus("Approaching spirit " .. tostring(sp.id)) else setStatus("Move within approx. " .. string.format("%.1f", reach) .. " studs of spirit " .. tostring(sp.id)) end end elseif autoTP and currentEnemy and selectedLand then setStatus("Next enemy: " .. currentEnemy.Name .. " | " .. selectedLand.Name) elseif (autoTP or autoSummon or autoRelease) and selectedLand then setStatus("Waiting for whitelisted enemies or spirits...") end task.wait(0.02) end end)