Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ESP = {}
- ESP.__index = ESP
- ESP.DefaultSettings = {
- Enabled = true,
- RefreshInterval = 10,
- FlashInterval = 2,
- Interval = true,
- Boxes = true,
- HealthBar = true,
- Distance = true,
- Names = true
- }
- function ESP:AddHealthBar(character: Model)
- local HealthBarConnections: table = {}
- end
- function ESP:AddDistance(character: Model)
- local DistanceConnections: table = {}
- end
- function ESP:AddName(character: Model)
- local NameConnections: table = {}
- end
- function ESP:AddBox(character: Model)
- local BoxConnections: table = {}
- local BoxOutline = Drawing.new("Square")
- BoxOutline.Visible = false
- BoxOutline.Color = Color3.fromRGB(0, 0, 0)
- BoxOutline.Thickness = 3
- BoxOutline.Transparency = 1
- BoxOutline.Filled = false
- local Box = Drawing.new("Square")
- Box.Visible = false
- Box.Color = Color3.fromRGB(255, 255, 255)
- Box.Thickness = 1
- Box.Transparency = 1
- Box.Filled = false
- table.insert(BoxConnections, game:GetService("RunService").RenderStepped:Connect(function()
- if character ~= nil and character.Parent ~= nil and character:FindFirstChildOfClass("Humanoid") and character:FindFirstChild("HumanoidRootPart") then
- local Root: Part = character.HumanoidRootPart
- local Head: Part = character.Head
- local Point, OnScreen = workspace.CurrentCamera:WorldToViewportPoint(Root.Position)
- local RootPoint: Vector3 = workspace.CurrentCamera:WorldToViewportPoint(Root.Position)
- local HeadPoint: Vector3 = workspace.CurrentCamera:WorldToViewportPoint(Head.Position + Vector3.new(0, 0.5, 0))
- local LegPoint: Vector3 = workspace.CurrentCamera:WorldToViewportPoint(Root.Position - Vector3.new(0,3,0))
- if OnScreen then
- BoxOutline.Size = Vector2.new(1000 / RootPoint.Z, HeadPoint.Y - LegPoint.Y)
- BoxOutline.Position = Vector2.new(RootPoint.X - BoxOutline.Size.X / 2, RootPoint.Y - BoxOutline.Size.Y / 2)
- BoxOutline.Visible = true
- Box.Size = Vector2.new(1000/ RootPoint.Z, HeadPoint.Y - LegPoint.Y)
- Box.Position = Vector2.new(RootPoint.X - Box.Size.X / 2, RootPoint.Y - Box.Size.Y / 2)
- Box.Visible = true
- end
- end
- end))
- return BoxConnections
- end
- function ESP:AddPlayer(player: Player)
- local function main()
- if self.Enabled then
- local char: Model = player.Character or player.CharacterAdded:Wait()
- local hum: Humanoid = char:FindFirstChildOfClass("Humanoid")
- if not hum then repeat task.wait() hum = hum:FindFirstChildOfClass("Humanoid") until hum and hum:IsA("Humanoid") end
- local Connections: table = {}
- if self.Boxes then table.insert(Connections, ESP:AddBox(player.Character)) end
- hum.Died:Connect(function()
- for i,v in pairs(Connections) do
- for _, category in pairs(v) do
- category:Disconnect()
- end
- end
- end)
- end
- end
- if player.Character and player.Character:FindFirstChildOfClass("Humanoid") then
- main()
- end
- player.CharacterAdded:Connect(main)
- end
- function ESP:Startup()
- for i,v in pairs(game:GetService("Players"):GetPlayers()) do
- ESP:AddPlayer(v)
- end
- game:GetService("Players").PlayerAdded:Connect(function(player: Player)
- ESP:AddPlayer(Player)
- end)
- end
- function ESP.new(settings: table)
- settings = settings or ESP.DefaultSettings
- return setmetatable(settings, ESP)
- end
- return ESP
Add Comment
Please, Sign In to add comment