Advertisement
_Thanh_Thy_Cute_

ROBLOX OFFSCREEN ESP

Jul 26th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. local Targets = {}
  2. local FieldOfView = 500
  3. local Dynamic = true
  4. local Team = false
  5. local Size = UDim2.new(0, 18, 0, 21)
  6. local Color = Color3.fromRGB(255, 255, 255)
  7.  
  8. local Players = game:GetService("Players")
  9. local LocalPlayer = Players.LocalPlayer
  10. local Camera = workspace.CurrentCamera
  11.  
  12. local ScreenGui = Instance.new("ScreenGui", game:GetService("CoreGui"))
  13. local Folder = Instance.new("Folder", ScreenGui)
  14.  
  15. local function Target(Player)
  16. local ImageLabel = Instance.new("ImageLabel", Folder)
  17. ImageLabel.Name = "ImageLabel"
  18. ImageLabel.ImageColor3 = Color
  19. ImageLabel.BackgroundTransparency = 1
  20. ImageLabel.Image = "http://www.roblox.com/asset/?id=6954524255"
  21.  
  22. Targets[Player.Name] = {
  23. Player = Player,
  24. Indicator = ImageLabel
  25. }
  26. end
  27.  
  28. for _, Player in next, Players:GetPlayers() do
  29. if Player ~= LocalPlayer then
  30. Target(Player)
  31. end
  32. end
  33.  
  34. Players.PlayerAdded:Connect(function(Player)
  35. Target(Player)
  36. end)
  37.  
  38. game:GetService("RunService").RenderStepped:connect(function()
  39. for Name, Target in next, Targets do
  40. if Target.Indicator then
  41. local Indicator = Target.Indicator
  42. if Players:FindFirstChild(Name) then
  43. Target = Target.Player
  44.  
  45. if LocalPlayer.Character and Target.Character and Target.Character:FindFirstChild("HumanoidRootPart") then
  46. local Character = Target.Character
  47. local WorldPosition = Character.HumanoidRootPart.Position
  48. local CameraVector = Camera.CFrame.Position
  49. local LookVector = Camera.CFrame.LookVector
  50. local ProjectVector = (WorldPosition - CameraVector)
  51. local Dot = LookVector:Dot(ProjectVector)
  52.  
  53. if Dot <= 0 then
  54. WorldPosition = (CameraVector + (ProjectVector - ((LookVector * Dot) * 1.01)))
  55. end
  56.  
  57. local ScreenPosition, Visible = Camera:WorldToScreenPoint(WorldPosition)
  58. local RayCast = workspace:FindPartOnRay(Ray.new(CameraVector, ((WorldPosition - CameraVector).Unit * 500)), LocalPlayer.Character, false, false)
  59.  
  60. if (Visible and RayCast and not RayCast:IsDescendantOf(Character)) or not Visible then
  61. local Center = (ScreenGui.AbsoluteSize / 2)
  62. local Direction = (Vector2.new(ScreenPosition.X, ScreenPosition.Y) - Center).Unit
  63. local Radian = math.atan2(Direction.X, Direction.Y)
  64. local Angle = (((math.pi * 2) / FieldOfView) * Radian)
  65. local ClampedPosition = (Center + (Direction * math.min(math.abs(((Center.Y - FieldOfView) / math.sin(Angle)) * FieldOfView), math.abs((Center.X - FieldOfView) / (math.cos(Angle)) / 2))))
  66.  
  67. Indicator.Position = UDim2.new(0, (ClampedPosition.X - (Indicator.Size.X.Offset / 2)), 0, ((ClampedPosition.Y - (Indicator.Size.Y.Offset / 2) - 15)))
  68. Indicator.Rotation = (-math.deg(Radian) + 180)
  69.  
  70. if Dynamic then
  71. local Magnitude = ((1 / (LocalPlayer.Character.HumanoidRootPart.Position - WorldPosition).Magnitude) * 1000)
  72.  
  73. if Magnitude > 18 then
  74. Magnitude = 18
  75. elseif Magnitude < 11 then
  76. Magnitude = 11
  77. end
  78.  
  79. Indicator.Size = UDim2.new(0, Magnitude, 0, (Magnitude + 3))
  80. else
  81. Indicator.Size = Size
  82. end
  83.  
  84. Indicator.Visible = true
  85. else
  86. Indicator.Visible = false
  87. end
  88. else
  89. Indicator.Visible = false
  90. end
  91.  
  92. if Team and Target.Team == LocalPlayer.Team then
  93. Indicator.Visible = false
  94. end
  95. else
  96. Indicator:Destroy()
  97. end
  98. end
  99. end
  100. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement