local esp = {} --// Internal stuff _G.tracersvisible = true _G.titlesvisible = true esp.__Internals = {} esp.__Internals.RunService = game:GetService("RunService") esp.__Internals.Camera = workspace.CurrentCamera esp.__Internals.Screen = esp.__Internals.Camera.ViewportSize esp.__Internals.Bottom = Vector2.new(esp.__Internals.Screen.X/2,esp.__Internals.Screen.Y) esp.__Internals.GetPoint = function(vector) local Position,OnScreen = esp.__Internals.Camera:WorldToScreenPoint(vector) return {Vector2.new(Position.X,Position.Y),OnScreen,Position.Z} end --// Tracer functions esp.Tracer = function(obj,color,thickness) pcall(function() local Tracer = Drawing.new("Line") Tracer.Transparency = 1 Tracer.Visible = false Tracer.From = esp.__Internals.Bottom Tracer.Color = color Tracer.Thickness = thickness local Render = esp.__Internals.RunService.RenderStepped:Connect(function() local Point = esp.__Internals.GetPoint(obj.Position) Tracer.To = Point[1] if _G.tracersvisible == true then Tracer.Visible = Point[2] else Tracer.Visible = false end end) obj.AncestryChanged:Connect(function() if not obj:IsDescendantOf(game) then Render:Disconnect() Tracer:Remove() end end) local TracerObject = setmetatable({},{__tostring=function()return"Tracer"end}) function TracerObject:Remove() Render:Disconnect() Tracer:Remove() end return TracerObject end) end esp.Title = function(obj,maincolor,textcolor,transparency,tab) pcall(function() local Title = Drawing.new("Square") Title.Filled = true Title.Color = maincolor Title.Thickness = 1 local Count = 0 -- Hacky method since # wasn't working for some reason for k,v in pairs(tab) do Count = Count + 1 end Title.Size = Vector2.new(200,Count * 20) local Offset = 0.2 * Count Title.Visible = true Title.Transparency = transparency local Properties = {} local i = 0 local Text for k=1,Count do -- Sorts in order instead of randomly local v=tab[k] local Distance = i * 16 Text = Drawing.new("Text") Text.Color = textcolor Text.Center = true Text.Size = 20 Text.Text = tostring(v.Object[v.Property]) Properties[k] = {["Distance"] = Distance,["Object"]=Text,["ActualObject"]=v.Object,["OutOf"]=v.OutOf,["Property"]=v.Property} i = i + 1 end local Render = esp.__Internals.RunService.RenderStepped:Connect(function() local Point = esp.__Internals.GetPoint(obj.Position + Vector3.new(0,2+Offset,0)) Title.Position = Point[1] - Vector2.new(Title.Size.X / 2,0) if _G.titlesvisible == true then Title.Visible = Point[2] else Title.Visible = false end local Biggest = 0 for k,v in pairs(Properties) do if _G.titlesvisible == true then v.Object.Visible = Point[2] else v.Object.Visible = false end v.Object.Position = Point[1] + Vector2.new(0,v.Distance) if v.OutOf == nil then v.Object.Text = v.ActualObject[v.Property] if #v.ActualObject[v.Property] > Biggest then Biggest = #v.ActualObject[v.Property] end else if v.ActualObject[v.Property] == nil then v.Object.Text = "" elseif typeof(v.ActualObject[v.Property]) == "Vector3" then local magn = (v.ActualObject[v.Property] - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude v.Object.Text = tostring(math.floor(magn)) else v.Object.Text = tostring(math.floor(v.ActualObject[v.Property])).. "/".. tostring(math.floor(v.ActualObject[v.OutOf])) end if #v.Object.Text > Biggest then Biggest = #v.Object.Text end end end if Biggest ~= 0 then Title.Size = Vector2.new(Biggest*8,Count * 20) end end) obj.AncestryChanged:Connect(function() if not obj:IsDescendantOf(game) then Render:Disconnect() Title:Remove() Text:Remove() for k,v in pairs(Properties) do v.Object:Remove() end end end) local TitleObject= setmetatable({},{__tostring=function()return"Title"end}) function TitleObject:Remove() Render:Disconnect() Title:Remove() for k,v in pairs(Properties) do v:Remove() end end return TitleObject end) end return esp