-- [[ 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 ]] if not game:IsLoaded() then game.Loaded:Wait() end local Players = game:GetService("Players") local localPlayer = Players.LocalPlayer assert(localPlayer, "Run this on the Roblox client.") local environment = getgenv and getgenv() or _G local previous = environment.__WarfareChamsCleanup if type(previous) == "function" then previous() end local running = true local records = {} local connections = {} local function connect(signal, callback, list) local connection = signal:Connect(function(...) if running then callback(...) end end) table.insert(list or connections, connection) end local function clearHighlight(record) if record.highlight then record.highlight:Destroy() record.highlight = nil end end local function getUnit(player) local unit = player:GetAttribute("Team") if unit == "Blue Unit" or unit == "Red Unit" then return unit end return nil end local function refresh(player) local record = records[player] if not record then return end clearHighlight(record) local character = record.character if not character then return end if player.Team and player.Team == localPlayer.Team then return end local ownTeam = getUnit(localPlayer) local otherTeam = getUnit(player) -- Neutral or unknown teams stay hidden until assigned to a unit. if not ownTeam or not otherTeam or ownTeam == otherTeam then return end local highlight = Instance.new("Highlight") highlight.Name = "WarfareEnemyHighlight" highlight.Adornee = character highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop highlight.FillColor = Color3.fromRGB(255, 40, 70) highlight.FillTransparency = 0.15 highlight.OutlineColor = Color3.new(1, 1, 1) highlight.OutlineTransparency = 0 highlight.Parent = character record.highlight = highlight end local function trackPlayer(player) if player == localPlayer or records[player] then return end local record = { character = player.Character, connections = {} } records[player] = record connect(player.CharacterAdded, function(character) record.character = character refresh(player) end, record.connections) connect(player.CharacterRemoving, function(character) if record.character == character then record.character = nil clearHighlight(record) end end, record.connections) for _, property in ipairs({"Team", "TeamColor", "Neutral"}) do connect(player:GetPropertyChangedSignal(property), function() refresh(player) end, record.connections) connect(player:GetAttributeChangedSignal("Team"), function() refresh(player) end, record.connections) end refresh(player) end local function removePlayer(player) local record = records[player] if not record then return end clearHighlight(record) for _, connection in ipairs(record.connections) do connection:Disconnect() end records[player] = nil end local function cleanup() if not running then return end running = false for _, connection in ipairs(connections) do connection:Disconnect() end for player in pairs(records) do removePlayer(player) end if environment.__WarfareChamsCleanup == cleanup then environment.__WarfareChamsCleanup = nil end end environment.__WarfareChamsCleanup = cleanup connect(Players.PlayerAdded, trackPlayer) connect(Players.PlayerRemoving, removePlayer) for _, property in ipairs({"Team", "TeamColor", "Neutral"}) do connect(localPlayer:GetPropertyChangedSignal(property), function() for player in pairs(records) do refresh(player) end end) connect(localPlayer:GetAttributeChangedSignal("Team"), function() for player in pairs(records) do refresh(player) end end) end if typeof(script) == "Instance" and script:IsA("LocalScript") then connect(script.Destroying, cleanup) end for _, player in ipairs(Players:GetPlayers()) do trackPlayer(player) end