-- [[ 0. 版本更替与防多开系统 ]] local SCRIPT_ID = "MyExclusiveHighlightSystem_2026" -- 如果发现后台有正在运行的旧版本,通知它自毁 if _G[SCRIPT_ID] then _G[SCRIPT_ID]() -- 执行旧脚本的清理回调 end -- 创建当前版本的自毁开关 local scriptActive = true _G[SCRIPT_ID] = function() scriptActive = false -- 关闭循环 -- 清理当前脚本产生的所有高亮,为新脚本腾地方 if _G.CurrentManagedParts then for part, data in pairs(_G.CurrentManagedParts) do if data.highlight then data.highlight:Destroy() end end end print("[系统] 旧版本脚本已成功卸载并清理。") end --------------------------------------------------------- local player = game.Players.LocalPlayer local myUsername = player.Name -- [[ 核心配置参数 ]] local R15_PER_PART = false local R6_PER_PART = true local UNIQUE_NAME = "ManagedHighlight" -- 获取血量颜色逻辑 local function getHealthColor(humanoid) local healthPercent = math.clamp(humanoid.Health / humanoid.MaxHealth, 0, 1) if humanoid.MaxHealth >= 9e9 or healthPercent >= 1 then return Color3.fromRGB(255, 255, 255) elseif healthPercent > 0.5 then local t = (healthPercent - 0.5) / 0.5 return Color3.fromRGB(255, 255, 0):Lerp(Color3.fromRGB(27, 252, 107), t) elseif healthPercent > 0 then local t = healthPercent / 0.5 return Color3.fromRGB(255, 0, 0):Lerp(Color3.fromRGB(255, 255, 0), t) else return Color3.fromRGB(255, 0, 0) end end -- 2. 全局安全管理池 _G.CurrentManagedParts = _G.CurrentManagedParts or {} local managedParts = _G.CurrentManagedParts local checkedCache = {} local function applyHighlight(target, model, isTool) if managedParts[target] then return end local data = { highlight = Instance.new("Highlight"), deathBurstHandled = false, sourceModel = model, feedbackTimer = isTool and 1.0 or 0 } local h = data.highlight h.Name = UNIQUE_NAME h.DepthMode = Enum.HighlightDepthMode.Occluded h.FillTransparency = 0 h.OutlineTransparency = 0 h.FillColor = Color3.fromRGB(255, 255, 255) h.OutlineColor = Color3.fromRGB(255, 255, 255) h.Adornee = target h.Parent = target managedParts[target] = data end -- 3. 瞬时拦截核心:当有任何新 Highlight 产生时立即处理 local function handleNewDescendant(obj) -- 【动态强杀】:如果是别的高亮,在生成的这一帧直接抹除 if obj:IsA("Highlight") and obj.Name ~= UNIQUE_NAME then -- 延迟一丁点时间确保完全避开引擎死锁漏洞并彻底粉碎 task.defer(function() if obj and obj.Parent then obj:Destroy() end end) return end -- 慢速判定的目标部分(依然走单次缓存判断) if not checkedCache[obj] then checkedCache[obj] = true local model = (obj:IsA("Model") and obj) or (obj:IsA("BasePart") and obj:FindFirstAncestorOfClass("Model")) if model then local hum = model:FindFirstChildOfClass("Humanoid") local isMatch = model.Name:find(myUsername) or (hum and (hum.DisplayName:find(myUsername) or hum.Name:find(myUsername))) if isMatch then local usePerPart = hum and ((hum.RigType == Enum.HumanoidRigType.R15 and R15_PER_PART) or (hum.RigType == Enum.HumanoidRigType.R6 and R6_PER_PART)) if usePerPart then if obj:IsA("BasePart") then applyHighlight(obj, model, obj:FindFirstAncestorOfClass("Tool") ~= nil) end else if obj == model then applyHighlight(model, model, false) end end end end end end -- 绑定动态瞬时监听 local descendantConnection = game.Workspace.DescendantAdded:Connect(handleNewDescendant) -- 初始扫描(顺便清理地图本就存在的杂余高亮) for _, v in ipairs(game.Workspace:GetDescendants()) do task.spawn(handleNewDescendant, v) end -- 4. 核心渲染控制循环(带自毁检测) task.spawn(function() local t_rainbow = 0 local t_death = 0 while scriptActive do for part, data in pairs(managedParts) do if not part:IsDescendantOf(game.Workspace) then if data.highlight then data.highlight:Destroy() end managedParts[part] = nil checkedCache[part] = nil else local h = data.highlight local hum = data.sourceModel:FindFirstChildOfClass("Humanoid") local isDead = hum and hum.Health <= 0 local inWhiteMode = data.sourceModel:FindFirstChildOfClass("ForceField") or (hum and hum.MaxHealth >= 9e9) if data.feedbackTimer > 0 then data.feedbackTimer = math.max(0, data.feedbackTimer - 0.05) end if isDead then if not data.deathBurstHandled then h.FillColor = Color3.fromRGB(255, 255, 255) h.OutlineColor = Color3.fromRGB(255, 255, 255) data.deathBurstHandled = true end t_death = t_death + 0.35 local targetOutline = Color3.fromRGB(255, 0, 0):Lerp(Color3.fromRGB(255, 0, 150), (math.sin(t_death) + 1) / 2) h.OutlineColor = h.OutlineColor:Lerp(targetOutline, 0.15) h.FillColor = h.FillColor:Lerp(Color3.fromRGB(120, 0, 10):Lerp(targetOutline, 0.1), 0.03) elseif inWhiteMode then local r, g, b = math.sin(t_rainbow)*127+128, math.sin(t_rainbow+2)*127+128, math.sin(t_rainbow+4)*127+128 h.FillColor = h.FillColor:Lerp(Color3.fromRGB(255, 255, 255), 0.2) h.OutlineColor = h.OutlineColor:Lerp(Color3.fromRGB(r, g, b):Lerp(Color3.fromRGB(255, 255, 255), data.feedbackTimer), 0.2) data.deathBurstHandled = false else local hColor = hum and getHealthColor(hum) or Color3.fromRGB(255, 255, 255) h.FillColor = h.FillColor:Lerp(Color3.fromRGB(0, 0, 0):Lerp(Color3.fromRGB(255, 255, 255), data.feedbackTimer), 0.04) h.OutlineColor = h.OutlineColor:Lerp(hColor:Lerp(Color3.fromRGB(255, 255, 255), data.feedbackTimer), 0.12) data.deathBurstHandled = false end end end t_rainbow = t_rainbow + 0.1 task.wait(0.02) end -- 当通知自毁后,断开全局动态监听,防止死灰复燃 if descendantConnection then descendantConnection:Disconnect() end end)