-- Services local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") -- Configuration for the highlight effect local HIGHLIGHT_COLOR = Color3.new(1, 1, 0) -- Yellow color (RGB: 255, 255, 0) local HIGHLIGHT_OUTLINE_COLOR = Color3.new(0, 0, 0) -- Black color (RGB: 0, 0, 0) local HIGHLIGHT_DEPTH_MODE = Enum.DepthMode.AlwaysOnTop -- Makes the highlight visible through objects -- Function to create and add the highlight to a character local function addHighlightToCharacter(character) -- Check if the character already has a highlight to prevent duplicates if character:FindFirstChildOfClass("Highlight") then return end -- Create a new Highlight instance local highlight = Instance.new("Highlight") highlight.Parent = character highlight.FillColor = HIGHLIGHT_COLOR highlight.OutlineColor = HIGHLIGHT_OUTLINE_COLOR highlight.DepthMode = HIGHLIGHT_DEPTH_MODE print("Highlight added to character: " .. character.Name) end -- Function to handle new players joining the game local function onPlayerAdded(player) print("Player joined: " .. player.Name) -- Wait for the player's character to spawn player.CharacterAdded:Wait() -- Add highlight to the new player's character addHighlightToCharacter(player.Character) -- Listen for when the character respawns to re-add the highlight player.CharacterAdded:Connect(addHighlightToCharacter) end -- Function to handle players leaving the game (optional but good practice) local function onPlayerRemoving(player) print("Player left: " .. player.Name) end -- Main script execution logic -- Add highlights to all players who are currently in the game for _, player in ipairs(Players:GetPlayers()) do -- Check if the player's character has already spawned if player.Character then addHighlightToCharacter(player.Character) end end -- Listen for new players joining the game Players.PlayerAdded:Connect(onPlayerAdded) -- Listen for players leaving the game Players.PlayerRemoving:Connect(onPlayerRemoving)