Advertisement
NiceBBMBThai

ESP RGB

Apr 18th, 2021
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.57 KB | None | 0 0
  1. -- Settings
  2. local Settings = {
  3. Box_Color = Color3.fromRGB(255, 0, 0),
  4. Box_Thickness = 50,
  5. Team_Check = false,
  6. Team_Color = false,
  7. Autothickness = true
  8. }
  9.  
  10. --Locals
  11. local Space = game:GetService("Workspace")
  12. local Player = game:GetService("Players").LocalPlayer
  13. local Camera = Space.CurrentCamera
  14.  
  15. -- Locals
  16. local function NewLine(color, thickness)
  17. local line = Drawing.new("Line")
  18. line.Visible = false
  19. line.From = Vector2.new(0, 0)
  20. line.To = Vector2.new(0, 0)
  21. line.Color = color
  22. line.Thickness = thickness
  23. line.Transparency = 1
  24. return line
  25. end
  26.  
  27. local function Vis(lib, state)
  28. for i, v in pairs(lib) do
  29. v.Visible = state
  30. end
  31. end
  32.  
  33. local function Colorize(lib, color)
  34. for i, v in pairs(lib) do
  35. v.Color = color
  36. end
  37. end
  38.  
  39. local Black = Color3.fromRGB(0, 0, 0)
  40.  
  41. local function Rainbow(lib, delay)
  42. for hue = 0, 1, 1/30 do
  43. local color = Color3.fromHSV(hue, 0.6, 1)
  44. Colorize(lib, color)
  45. wait(delay)
  46. end
  47. Rainbow(lib)
  48. end
  49. --Main Draw Function
  50. local function Main(plr)
  51. repeat wait() until plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") ~= nil
  52. local R15
  53. if plr.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
  54. R15 = true
  55. else
  56. R15 = false
  57. end
  58. local Library = {
  59. TL1 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  60. TL2 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  61.  
  62. TR1 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  63. TR2 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  64.  
  65. BL1 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  66. BL2 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  67.  
  68. BR1 = NewLine(Settings.Box_Color, Settings.Box_Thickness),
  69. BR2 = NewLine(Settings.Box_Color, Settings.Box_Thickness)
  70. }
  71. coroutine.wrap(Rainbow)(Library, 0.15)
  72. local oripart = Instance.new("Part")
  73. oripart.Parent = Space
  74. oripart.Transparency = 1
  75. oripart.CanCollide = false
  76. oripart.Size = Vector3.new(1, 1, 1)
  77. oripart.Position = Vector3.new(0, 0, 0)
  78. --Updater Loop
  79. local function Updater()
  80. local c
  81. c = game:GetService("RunService").RenderStepped:Connect(function()
  82. if plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") ~= nil and plr.Character:FindFirstChild("HumanoidRootPart") ~= nil and plr.Character.Humanoid.Health > 0 and plr.Character:FindFirstChild("Head") ~= nil then
  83. local Hum = plr.Character
  84. local HumPos, vis = Camera:WorldToViewportPoint(Hum.HumanoidRootPart.Position)
  85. if vis then
  86. oripart.Size = Vector3.new(Hum.HumanoidRootPart.Size.X, Hum.HumanoidRootPart.Size.Y*1.5, Hum.HumanoidRootPart.Size.Z)
  87. oripart.CFrame = CFrame.new(Hum.HumanoidRootPart.CFrame.Position, Camera.CFrame.Position)
  88. local SizeX = oripart.Size.X
  89. local SizeY = oripart.Size.Y
  90. local TL = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(SizeX, SizeY, 0)).p)
  91. local TR = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(-SizeX, SizeY, 0)).p)
  92. local BL = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(SizeX, -SizeY, 0)).p)
  93. local BR = Camera:WorldToViewportPoint((oripart.CFrame * CFrame.new(-SizeX, -SizeY, 0)).p)
  94.  
  95. if Settings.Team_Check then
  96. if plr.TeamColor == Player.TeamColor then
  97. Colorize(Library, Color3.fromRGB(0, 255, 0))
  98. else
  99. Colorize(Library, Color3.fromRGB(255, 0, 0))
  100. end
  101. end
  102.  
  103. if Settings.Team_Color then
  104. Colorize(Library, plr.TeamColor.Color)
  105. end
  106.  
  107. local ratio = (Camera.CFrame.p - Hum.HumanoidRootPart.Position).magnitude
  108. local offset = math.clamp(1/ratio*750, 2, 300)
  109.  
  110. Library.TL1.From = Vector2.new(TL.X, TL.Y)
  111. Library.TL1.To = Vector2.new(TL.X + offset, TL.Y)
  112. Library.TL2.From = Vector2.new(TL.X, TL.Y)
  113. Library.TL2.To = Vector2.new(TL.X, TL.Y + offset)
  114.  
  115. Library.TR1.From = Vector2.new(TR.X, TR.Y)
  116. Library.TR1.To = Vector2.new(TR.X - offset, TR.Y)
  117. Library.TR2.From = Vector2.new(TR.X, TR.Y)
  118. Library.TR2.To = Vector2.new(TR.X, TR.Y + offset)
  119.  
  120. Library.BL1.From = Vector2.new(BL.X, BL.Y)
  121. Library.BL1.To = Vector2.new(BL.X + offset, BL.Y)
  122. Library.BL2.From = Vector2.new(BL.X, BL.Y)
  123. Library.BL2.To = Vector2.new(BL.X, BL.Y - offset)
  124.  
  125. Library.BR1.From = Vector2.new(BR.X, BR.Y)
  126. Library.BR1.To = Vector2.new(BR.X - offset, BR.Y)
  127. Library.BR2.From = Vector2.new(BR.X, BR.Y)
  128. Library.BR2.To = Vector2.new(BR.X, BR.Y - offset)
  129.  
  130. Vis(Library, true)
  131.  
  132. if Settings.Autothickness then
  133. local distance = (Player.Character.HumanoidRootPart.Position - oripart.Position).magnitude
  134. local value = math.clamp(1/distance*100, 1, 4) --0.1 is min thickness, 6 is max
  135. for u, x in pairs(Library) do
  136. x.Thickness = value
  137. end
  138. else
  139. for u, x in pairs(Library) do
  140. x.Thickness = Settings.Box_Thickness
  141. end
  142. end
  143. else
  144. Vis(Library, false)
  145. end
  146. else
  147. Vis(Library, false)
  148. if game:GetService("Players"):FindFirstChild(plr.Name) == nil then
  149. for i, v in pairs(Library) do
  150. v:Remove()
  151. oripart:Destroy()
  152. end
  153. c:Disconnect()
  154. end
  155. end
  156. end)
  157. end
  158. coroutine.wrap(Updater)()
  159. end
  160.  
  161. -- Draw Boxes
  162. for i, v in pairs(game:GetService("Players"):GetPlayers()) do
  163. if v.Name ~= Player.Name then
  164. coroutine.wrap(Main)(v)
  165. end
  166. end
  167.  
  168. game:GetService("Players").PlayerAdded:Connect(function(newplr)
  169. coroutine.wrap(Main)(newplr)
  170. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement