Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Advanced Universal Line ESP Script
- -- Works for all Roblox games with Rainbow Line Color
- local players = game:GetService("Players")
- local localPlayer = players.LocalPlayer
- local camera = game.Workspace.CurrentCamera
- local runService = game:GetService("RunService")
- local espLines = {} -- Table to keep track of ESP lines
- -- Function to get a rainbow color based on time
- local function getRainbowColor()
- local hue = tick() % 5 / 5 -- Cycle through hue values over time
- return Color3.fromHSV(hue, 1, 1) -- Return a Color3 value from HSV color space
- end
- -- Create Line ESP for a specific player
- function createESPLine(player)
- -- Function to actually create and manage the ESP line
- local function setupLine()
- local character = player.Character or player.CharacterAdded:Wait()
- local rootPart = character:WaitForChild("HumanoidRootPart")
- local line = Drawing.new("Line")
- line.Thickness = 2
- line.Transparency = 1
- -- Store the line in the table
- espLines[player] = line
- -- Update the line position and color every frame
- local updateConnection
- updateConnection = runService.RenderStepped:Connect(function()
- if character and rootPart and character:FindFirstChildOfClass("Humanoid") then
- local charPosition = rootPart.Position
- local screenPos, onScreen = camera:WorldToViewportPoint(charPosition)
- -- Update line color to rainbow
- line.Color = getRainbowColor()
- if onScreen then
- local from = Vector2.new(camera.ViewportSize.X / 2, camera.ViewportSize.Y) -- From camera center
- local to = Vector2.new(screenPos.X, screenPos.Y) -- To player
- line.From = from
- line.To = to
- line.Visible = true
- else
- line.Visible = false
- end
- else
- line.Visible = false
- end
- end)
- -- Handle player character removal (e.g., death)
- player.CharacterRemoving:Connect(function()
- line.Visible = false
- updateConnection:Disconnect() -- Stop updating the line
- end)
- end
- -- Ensure the ESP is created when the player spawns or respawns
- player.CharacterAdded:Connect(function()
- setupLine()
- end)
- -- Create the ESP line initially for players already in-game
- if player.Character then
- setupLine()
- end
- end
- -- Remove Line ESP when player leaves
- function removeESPLine(player)
- if espLines[player] then
- espLines[player]:Remove() -- Remove the line
- espLines[player] = nil -- Clear from table
- end
- end
- -- Apply ESP to all players in the game
- for _, player in pairs(players:GetPlayers()) do
- createESPLine(player)
- end
- -- Update for new players joining the game
- players.PlayerAdded:Connect(function(player)
- createESPLine(player)
- end)
- -- Remove ESP line when player leaves
- players.PlayerRemoving:Connect(function(player)
- removeESPLine(player)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement