local Teams = { game:GetService("Teams").Criminals, game:GetService("Teams").Lobby, game:GetService("Teams").Sheriffs } local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local Camera = workspace.CurrentCamera local TeamColors = { Criminals = Color3.fromRGB(255, 0, 0), Sheriffs = Color3.fromRGB(0, 0, 255), Lobby = Color3.fromRGB(128, 128, 128) } local ESPObjects = {} local ESPFolder = Instance.new("Folder") ESPFolder.Name = "ESP" ESPFolder.Parent = game.CoreGui function CreateESP(player) if ESPObjects[player] then ESPObjects[player]:Destroy() ESPObjects[player] = nil end local character = player.Character if not character then return end local humanoid = character:FindFirstChild("Humanoid") if not humanoid then return end local Highlight = Instance.new("Highlight") Highlight.Name = player.Name .. "ESP" Highlight.Parent = ESPFolder Highlight.Adornee = character Highlight.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop Highlight.FillTransparency = 0.5 Highlight.OutlineColor = Color3.new(1, 1, 1) if player.Team then Highlight.FillColor = TeamColors[player.Team.Name] or Color3.new(1, 1, 1) end ESPObjects[player] = Highlight local teamConnection teamConnection = player:GetPropertyChangedSignal("Team"):Connect(function() if player.Team and Highlight then Highlight.FillColor = TeamColors[player.Team.Name] or Color3.new(1, 1, 1) end end) local diedConnection diedConnection = humanoid.Died:Connect(function() if Highlight then Highlight:Destroy() ESPObjects[player] = nil end if teamConnection then teamConnection:Disconnect() end if diedConnection then diedConnection:Disconnect() end end) Highlight.Destroying:Connect(function() if teamConnection then teamConnection:Disconnect() end if diedConnection then diedConnection:Disconnect() end ESPObjects[player] = nil end) end function ShouldShowESP(player) return player ~= LocalPlayer and table.find(Teams, player.Team) end function OnCharacterAdded(player, character) if not ShouldShowESP(player) then return end local humanoid = character:WaitForChild("Humanoid") wait(0.5) CreateESP(player) end function OnPlayerAdded(player) player.CharacterAdded:Connect(function(character) OnCharacterAdded(player, character) end) if player.Character then OnCharacterAdded(player, player.Character) end player:GetPropertyChangedSignal("Team"):Connect(function() if ShouldShowESP(player) then if player.Character then OnCharacterAdded(player, player.Character) end else if ESPObjects[player] then ESPObjects[player]:Destroy() ESPObjects[player] = nil end end end) end function OnPlayerRemoving(player) if ESPObjects[player] then ESPObjects[player]:Destroy() ESPObjects[player] = nil end end for _, player in ipairs(Players:GetPlayers()) do if ShouldShowESP(player) then OnPlayerAdded(player) end end Players.PlayerAdded:Connect(OnPlayerAdded) Players.PlayerRemoving:Connect(OnPlayerRemoving) for _, team in ipairs(Teams) do team.PlayerAdded:Connect(function(player) if player.Character then OnCharacterAdded(player, player.Character) end end) end function UpdateAllESP() for _, player in ipairs(Players:GetPlayers()) do if ShouldShowESP(player) and player.Character then CreateESP(player) elseif ESPObjects[player] then ESPObjects[player]:Destroy() ESPObjects[player] = nil end end end while true do wait(5) UpdateAllESP() end