Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Esp = {}
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local highlights = {}
- Esp.Enabled = true
- Esp.Transparency = 0.6
- Esp.Outline = true
- Esp.CurrentColor = "Red"
- Esp.Colors = {
- Red = Color3.fromRGB(255,0,0),
- Green = Color3.fromRGB(0,255,0),
- Blue = Color3.fromRGB(0,0,255),
- Yellow = Color3.fromRGB(255,255,0),
- Purple = Color3.fromRGB(170,0,255),
- Orange = Color3.fromRGB(255,165,0),
- White = Color3.fromRGB(255,255,255),
- Black = Color3.fromRGB(0,0,0),
- Cyan = Color3.fromRGB(0,255,255),
- Magenta = Color3.fromRGB(255,0,255),
- Pink = Color3.fromRGB(255,192,203),
- Lime = Color3.fromRGB(0,255,0),
- Gray = Color3.fromRGB(128,128,128),
- Brown = Color3.fromRGB(139,69,19),
- Gold = Color3.fromRGB(255,215,0)
- }
- local function createHighlight(player)
- if not player.Character then return end
- if highlights[player] then highlights[player]:Destroy() end
- local hi = Instance.new("Highlight")
- hi.Name = "ESPHighlight"
- hi.Adornee = player.Character
- hi.Parent = player.Character
- hi.FillTransparency = Esp.Transparency
- hi.OutlineTransparency = Esp.Outline and 0 or 1
- hi.FillColor = Esp.Colors[Esp.CurrentColor] or Color3.fromRGB(255,0,0)
- hi.OutlineColor = Color3.fromRGB(255,255,255)
- highlights[player] = hi
- end
- local function removeHighlight(player)
- if highlights[player] then
- highlights[player]:Destroy()
- highlights[player] = nil
- end
- end
- local function updateAll()
- for _,p in pairs(Players:GetPlayers()) do
- if p ~= LocalPlayer then
- if p.Character and Esp.Enabled then createHighlight(p) end
- end
- end
- end
- function Esp:CreateEsp(name,color,updateable)
- Esp.CurrentColor = color or "Red"
- for _,p in pairs(Players:GetPlayers()) do
- if p ~= LocalPlayer then
- if p.Character then createHighlight(p) end
- if updateable then
- p.CharacterAdded:Connect(function() if Esp.Enabled then createHighlight(p) end end)
- p.CharacterRemoving:Connect(function() removeHighlight(p) end)
- end
- end
- end
- if updateable then
- Players.PlayerAdded:Connect(function(p)
- if p ~= LocalPlayer then
- p.CharacterAdded:Connect(function() if Esp.Enabled then createHighlight(p) end end)
- p.CharacterRemoving:Connect(function() removeHighlight(p) end)
- end
- end)
- Players.PlayerRemoving:Connect(function(p) removeHighlight(p) end)
- end
- end
- function Esp:RemoveAll()
- for p,_ in pairs(highlights) do
- removeHighlight(p)
- end
- end
- function Esp:ChangeColor(color)
- Esp.CurrentColor = color or Esp.CurrentColor
- updateAll()
- end
- function Esp:Set(state)
- Esp.Enabled = state
- if not state then self:RemoveAll() else updateAll() end
- end
- function Esp:SetTransparency(value)
- Esp.Transparency = value or Esp.Transparency
- updateAll()
- end
- function Esp:SetOutline(state)
- Esp.Outline = state
- updateAll()
- end
- return Esp
Advertisement
Add Comment
Please, Sign In to add comment