Advertisement
Guest User

Aimbot

a guest
Dec 12th, 2019
1,704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. print("Key to toggle esp is f9.")
  2. print("Aim-key is Left Ctrl.")
  3.  
  4. ENABLED = false
  5. PLAYER = game.Players.LocalPlayer
  6. MOUSE = PLAYER:GetMouse()
  7. CC = game.Workspace.CurrentCamera
  8. _G.FREE_FOR_ALL = true
  9. _G.BIND = 50
  10. _G.AIM_AT = 'Head'
  11. local player = game.Players.LocalPlayer
  12. local esp = false
  13. local track = false
  14.  
  15.  
  16.  
  17. function Create(base, team)
  18. local bb = Instance.new("BillboardGui",player.PlayerGui)
  19. bb.Adornee = base
  20. bb.ExtentsOffset = Vector3.new(0,1,0)
  21. bb.AlwaysOnTop = true
  22. bb.Size = UDim2.new(0,5,0,5)
  23. bb.StudsOffset = Vector3.new(0,1,0)
  24. bb.Name = "tracker"
  25. local frame = Instance.new("Frame",bb)
  26. frame.ZIndex = 10
  27. frame.BackgroundTransparency = 0.3
  28. frame.Size = UDim2.new(1,0,1,0)
  29. frame.Position = UDim2.new(0,0,0)
  30. frame.Transparency = 1
  31. local txtlbl = Instance.new("TextLabel",bb)
  32. txtlbl.ZIndex = 10
  33. txtlbl.Text = (string.upper(base.Parent.Name))
  34. txtlbl.BackgroundTransparency = 1
  35. txtlbl.Position = UDim2.new(0,0,0,-35)
  36. txtlbl.Size = UDim2.new(1,0,10,0)
  37. txtlbl.Font = "SourceSansBold"
  38. txtlbl.FontSize = "Size10"
  39. txtlbl.TextStrokeTransparency = 0.5
  40.  
  41. local txtlbl2 = Instance.new("TextLabel",bb)
  42. txtlbl2.ZIndex = 10
  43. txtlbl2.Text = (math.floor(base.Parent.Humanoid.Health*100)/100)
  44. txtlbl2.BackgroundTransparency = 1
  45. txtlbl2.Position = UDim2.new(0,0,0,-25)
  46. txtlbl2.Size = UDim2.new(1,0,10,0)
  47. txtlbl2.Font = "SourceSansBold"
  48. txtlbl2.FontSize = "Size10"
  49.  
  50. txtlbl2.TextStrokeTransparency = 0.5
  51. if team then
  52. txtlbl.TextColor3 = Color3.new(255,0,0)
  53. txtlbl2.TextColor3 = Color3.new(255,0,0)
  54. frame.BackgroundColor3 = Color3.new(255,0,0)
  55.  
  56. elseif base.Parent.Name == "whielist kid" or base.Parent.Name == "second whitelist kid here" then
  57. txtlbl.TextColor3 = Color3.new(0,255,0)
  58. txtlbl2.TextColor3 = Color3.new(0,255,0)
  59. frame.BackgroundColor3 = Color3.new(0,255,0)
  60. txtlbl.Text = "FRIEND"
  61. txtlbl.FontSize = "Size14"
  62. txtlbl2.FontSize = "Size14"
  63.  
  64.  
  65.  
  66. elseif base.Parent.Name == game.Players.LocalPlayer.Name then
  67. txtlbl2.Transparency = 1
  68. txtlbl.Transparency = 1
  69. frame.Transparency = 1
  70. else
  71. txtlbl.TextColor3 = Color3.new(255,0,0)
  72. txtlbl2.TextColor3 = Color3.new(255,0,0)
  73. frame.BackgroundColor3 = Color3.new(255,0,0)
  74.  
  75. end
  76. end
  77.  
  78.  
  79. function Find()
  80. Clear()
  81. track = true
  82. spawn(function()
  83. while wait() do
  84. if track then
  85. Clear()
  86. for _,v in pairs(game.Players:players()) do
  87.  
  88. if v.Character and v.Character.Head then
  89. Create(v.Character.Head, false)
  90. end
  91. end
  92. end
  93. end
  94. wait(1)
  95. end)
  96. end
  97. function Clear()
  98. for _,v in pairs(player.PlayerGui:children()) do
  99. if v.Name == "tracker" and v:isA("BillboardGui") then
  100. v:Destroy()
  101. end
  102. end
  103. end
  104. mouse=game.Players.LocalPlayer:GetMouse()
  105. mouse.keyDown:connect(function(key)
  106. if key == "f9" then
  107. if not esp then
  108. Find()
  109. print("ESP ENABLED")
  110. esp = true
  111. else
  112. Clear()
  113. track = false
  114. print("ESP DISABLED")
  115. esp = false
  116. end
  117.  
  118.  
  119.  
  120.  
  121. end
  122.  
  123. end)
  124.  
  125.  
  126.  
  127.  
  128. --aimbot
  129.  
  130.  
  131. function GetNearestPlayerToMouse()
  132. local PLAYERS = {}
  133. local PLAYER_HOLD = {}
  134. local DISTANCES = {}
  135. for i, v in pairs(game.Players:GetPlayers()) do
  136. if v ~= PLAYER then
  137. table.insert(PLAYERS, v)
  138. end
  139. end
  140. for i, v in pairs(PLAYERS) do
  141. if _G.FREE_FOR_ALL == false then
  142. if v and (v.Character) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  143. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  144. if AIM ~= nil then
  145. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  146. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  147. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  148. local DIFF = math.floor((POS - AIM.Position).magnitude)
  149. PLAYER_HOLD[v.Name .. i] = {}
  150. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  151. PLAYER_HOLD[v.Name .. i].plr = v
  152. PLAYER_HOLD[v.Name .. i].diff = DIFF
  153. table.insert(DISTANCES, DIFF)
  154. end
  155. end
  156. elseif _G.FREE_FOR_ALL == true then
  157. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  158. if AIM ~= nil then
  159. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  160. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  161. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  162. local DIFF = math.floor((POS - AIM.Position).magnitude)
  163. PLAYER_HOLD[v.Name .. i] = {}
  164. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  165. PLAYER_HOLD[v.Name .. i].plr = v
  166. PLAYER_HOLD[v.Name .. i].diff = DIFF
  167. table.insert(DISTANCES, DIFF)
  168. end
  169. end
  170. end
  171.  
  172. if unpack(DISTANCES) == nil then
  173. return false
  174. end
  175.  
  176. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  177. if L_DISTANCE > 20 then
  178. return false
  179. end
  180.  
  181. for i, v in pairs(PLAYER_HOLD) do
  182. if v.diff == L_DISTANCE then
  183. return v.plr
  184. end
  185. end
  186. return false
  187. end
  188.  
  189. local TRACK = falsea
  190.  
  191.  
  192. MOUSE.KeyDown:connect(function(KEY)
  193. KEY = KEY:lower():byte()
  194. if KEY == _G.BIND then
  195. ENABLED = true
  196. end
  197. end)
  198. MOUSE.KeyUp:connect(function(KEY)
  199. KEY = KEY:lower():byte()
  200. if KEY == _G.BIND then
  201. ENABLED = false
  202. end
  203. end)
  204.  
  205. game:GetService('RunService').RenderStepped:connect(function()
  206. if ENABLED then
  207. local TARGET = GetNearestPlayerToMouse()
  208. if TARGET.Name == "Whitelist kid here" or TARGET.Name == "second whitelist kid here" then
  209. else
  210.  
  211. if (TARGET ~= false) then
  212. local AIM = TARGET.Character:FindFirstChild(_G.AIM_AT)
  213. if AIM then
  214. CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  215. end
  216. end
  217. end
  218. end
  219. end)
  220.  
  221. _G.AIM_AT = 'Torso'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement