wlvs

roblox esp

Nov 20th, 2024 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Players = game:GetService("Players")
  2. local LocalPlayer = Players.LocalPlayer
  3.  
  4. -- Function to add a Highlight to a character
  5. local function addHighlightToCharacter(character)
  6. if not character:FindFirstChild("Highlight") then
  7. local highlight = Instance.new("Highlight")
  8. highlight.Parent = character
  9. highlight.FillColor = Color3.new(9, 9, 9) -- Red highlight
  10. highlight.OutlineColor = Color3.new(0, 1, 0) -- White outline
  11. end
  12. end
  13.  
  14. -- Function to handle when a player's character is added
  15. local function handleCharacterAdded(character)
  16. addHighlightToCharacter(character)
  17. end
  18.  
  19. -- Function to monitor new players
  20. local function handlePlayerAdded(player)
  21. -- Add highlight if the player's character already exists
  22. if player.Character then
  23. handleCharacterAdded(player.Character)
  24. end
  25. -- Connect to CharacterAdded for future character spawns
  26. player.CharacterAdded:Connect(handleCharacterAdded)
  27. end
  28.  
  29. -- Connect existing players
  30. for _, player in pairs(Players:GetPlayers()) do
  31. if player ~= LocalPlayer then
  32. handlePlayerAdded(player)
  33. end
  34. end
  35.  
  36. -- Connect new players
  37. Players.PlayerAdded:Connect(function(player)
  38. if player ~= LocalPlayer then
  39. handlePlayerAdded(player)
  40. end
  41. end)
  42.  
Advertisement
Add Comment
Please, Sign In to add comment