Advertisement
qiell

line esp

Oct 10th, 2024
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. -- Advanced Universal Line ESP Script
  2. -- Works for all Roblox games with Rainbow Line Color
  3.  
  4. local players = game:GetService("Players")
  5. local localPlayer = players.LocalPlayer
  6. local camera = game.Workspace.CurrentCamera
  7. local runService = game:GetService("RunService")
  8.  
  9. local espLines = {} -- Table to keep track of ESP lines
  10.  
  11. -- Function to get a rainbow color based on time
  12. local function getRainbowColor()
  13. local hue = tick() % 5 / 5 -- Cycle through hue values over time
  14. return Color3.fromHSV(hue, 1, 1) -- Return a Color3 value from HSV color space
  15. end
  16.  
  17. -- Create Line ESP for a specific player
  18. function createESPLine(player)
  19. -- Function to actually create and manage the ESP line
  20. local function setupLine()
  21. local character = player.Character or player.CharacterAdded:Wait()
  22. local rootPart = character:WaitForChild("HumanoidRootPart")
  23.  
  24. local line = Drawing.new("Line")
  25. line.Thickness = 2
  26. line.Transparency = 1
  27.  
  28. -- Store the line in the table
  29. espLines[player] = line
  30.  
  31. -- Update the line position and color every frame
  32. local updateConnection
  33. updateConnection = runService.RenderStepped:Connect(function()
  34. if character and rootPart and character:FindFirstChildOfClass("Humanoid") then
  35. local charPosition = rootPart.Position
  36. local screenPos, onScreen = camera:WorldToViewportPoint(charPosition)
  37.  
  38. -- Update line color to rainbow
  39. line.Color = getRainbowColor()
  40.  
  41. if onScreen then
  42. local from = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y) -- From camera center
  43. local to = Vector2.new(screenPos.X, screenPos.Y) -- To player
  44. line.From = from
  45. line.To = to
  46. line.Visible = true
  47. else
  48. line.Visible = false
  49. end
  50. else
  51. line.Visible = false
  52. end
  53. end)
  54.  
  55. -- Handle player character removal (e.g., death)
  56. player.CharacterRemoving:Connect(function()
  57. line.Visible = false
  58. updateConnection:Disconnect() -- Stop updating the line
  59. end)
  60. end
  61.  
  62. -- Ensure the ESP is created when the player spawns or respawns
  63. player.CharacterAdded:Connect(function()
  64. setupLine()
  65. end)
  66.  
  67. -- Create the ESP line initially for players already in-game
  68. if player.Character then
  69. setupLine()
  70. end
  71. end
  72.  
  73. -- Remove Line ESP when player leaves
  74. function removeESPLine(player)
  75. if espLines[player] then
  76. espLines[player]:Remove() -- Remove the line
  77. espLines[player] = nil -- Clear from table
  78. end
  79. end
  80.  
  81. -- Apply ESP to all players in the game
  82. for _, player in pairs(players:GetPlayers()) do
  83. createESPLine(player)
  84. end
  85.  
  86. -- Update for new players joining the game
  87. players.PlayerAdded:Connect(function(player)
  88. createESPLine(player)
  89. end)
  90.  
  91. -- Remove ESP line when player leaves
  92. players.PlayerRemoving:Connect(function(player)
  93. removeESPLine(player)
  94. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement