Anymous_Scripter

Esp

Mar 15th, 2024
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2. local UserInputService = game:GetService("UserInputService")
  3. local ContextActionService = game:GetService("ContextActionService")
  4.  
  5. local function CreateNameTag(player)
  6. local character = player.Character or player.CharacterAdded:Wait()
  7. local head = character:WaitForChild("Head")
  8.  
  9. if head:FindFirstChild("NameTag") then
  10. return
  11. end
  12.  
  13. local billboardGui = Instance.new("BillboardGui")
  14. billboardGui.Name = "NameTag"
  15. billboardGui.Adornee = head
  16. billboardGui.Size = UDim2.new(0, 200, 0, 50)
  17. billboardGui.StudsOffset = Vector3.new(0, 2, 0)
  18. billboardGui.AlwaysOnTop = true
  19.  
  20. local textLabel = Instance.new("TextLabel")
  21. textLabel.BackgroundTransparency = 1
  22. textLabel.Size = UDim2.new(1, 0, 1, 0)
  23. textLabel.Text = player.Name
  24. textLabel.Font = Enum.Font.SourceSansBold
  25. textLabel.TextSize = 14
  26. textLabel.TextColor3 = Color3.new(1, 1, 1)
  27.  
  28. textLabel.Parent = billboardGui
  29. billboardGui.Parent = head
  30. end
  31.  
  32. local function RefreshHighlights()
  33. for i, Player in pairs(Players:GetPlayers()) do
  34. if Player ~= Players.LocalPlayer then
  35. local Character = Player.Character
  36. if Character then
  37. if Character:FindFirstChildWhichIsA("Highlight") then
  38. Character:FindFirstChildWhichIsA("Highlight"):Destroy()
  39. end
  40.  
  41. local Highlight = Instance.new("Highlight")
  42. Highlight.FillColor = Color3.fromRGB(255, 255, 0)
  43. Highlight.Parent = Character
  44. end
  45. end
  46. end
  47. end
  48.  
  49. local function ToggleHighlight(actionName, inputState, inputObject)
  50. if inputState == Enum.UserInputState.Begin then
  51. RefreshHighlights()
  52. end
  53. end
  54.  
  55. Players.PlayerAdded:Connect(function(player)
  56. CreateNameTag(player)
  57. RefreshHighlights()
  58. end)
  59.  
  60. for _, player in pairs(Players:GetPlayers()) do
  61. CreateNameTag(player)
  62. RefreshHighlights()
  63. end
  64.  
  65. if UserInputService.TouchEnabled then
  66. ContextActionService:BindAction("ToggleHighlight", ToggleHighlight, false, Enum.KeyCode.ButtonR1)
  67. end
  68.  
  69. while wait(1) do
  70. RefreshHighlights()
  71. end
  72.  
Advertisement
Add Comment
Please, Sign In to add comment