Advertisement
randomjunkaccountyes

KAT Aimlock & ESP (OP)

Sep 11th, 2019
20,751
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. PLAYER = game.Players.LocalPlayer
  2. MOUSE = PLAYER:GetMouse()
  3. CC = game.Workspace.CurrentCamera
  4.  
  5. ENABLED = false
  6. ESP_ENABLED = false
  7.  
  8. _G.FREE_FOR_ALL = true
  9.  
  10. _G.BIND = 50
  11. _G.ESP_BIND = 52
  12. _G.CHANGE_AIM = 'q'
  13.  
  14. _G.AIM_AT = 'Torso'
  15.  
  16. wait(1)
  17.  
  18. function GetNearestPlayerToMouse()
  19. local PLAYERS = {}
  20. local PLAYER_HOLD = {}
  21. local DISTANCES = {}
  22. for i, v in pairs(game.Players:GetPlayers()) do
  23. if v ~= PLAYER then
  24. table.insert(PLAYERS, v)
  25. end
  26. end
  27. for i, v in pairs(PLAYERS) do
  28. if _G.FREE_FOR_ALL == false then
  29. if v and (v.Character) ~= nil and v.TeamColor ~= PLAYER.TeamColor then
  30. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  31. if AIM ~= nil then
  32. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  33. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  34. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  35. local DIFF = math.floor((POS - AIM.Position).magnitude)
  36. PLAYER_HOLD[v.Name .. i] = {}
  37. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  38. PLAYER_HOLD[v.Name .. i].plr = v
  39. PLAYER_HOLD[v.Name .. i].diff = DIFF
  40. table.insert(DISTANCES, DIFF)
  41. end
  42. end
  43. elseif _G.FREE_FOR_ALL == true then
  44. local AIM = v.Character:FindFirstChild(_G.AIM_AT)
  45. if AIM ~= nil then
  46. local DISTANCE = (AIM.Position - game.Workspace.CurrentCamera.CoordinateFrame.p).magnitude
  47. local RAY = Ray.new(game.Workspace.CurrentCamera.CoordinateFrame.p, (MOUSE.Hit.p - CC.CoordinateFrame.p).unit * DISTANCE)
  48. local HIT,POS = game.Workspace:FindPartOnRay(RAY, game.Workspace)
  49. local DIFF = math.floor((POS - AIM.Position).magnitude)
  50. PLAYER_HOLD[v.Name .. i] = {}
  51. PLAYER_HOLD[v.Name .. i].dist = DISTANCE
  52. PLAYER_HOLD[v.Name .. i].plr = v
  53. PLAYER_HOLD[v.Name .. i].diff = DIFF
  54. table.insert(DISTANCES, DIFF)
  55. end
  56. end
  57. end
  58.  
  59. if unpack(DISTANCES) == nil then
  60. return false
  61. end
  62.  
  63. local L_DISTANCE = math.floor(math.min(unpack(DISTANCES)))
  64. if L_DISTANCE > 20 then
  65. return false
  66. end
  67.  
  68. for i, v in pairs(PLAYER_HOLD) do
  69. if v.diff == L_DISTANCE then
  70. return v.plr
  71. end
  72. end
  73. return false
  74. end
  75.  
  76. GUI_MAIN = Instance.new('ScreenGui', game.CoreGui)
  77. GUI_TARGET = Instance.new('TextLabel', GUI_MAIN)
  78. GUI_AIM_AT = Instance.new('TextLabel', GUI_MAIN)
  79.  
  80. GUI_MAIN.Name = 'AIMBOT'
  81.  
  82. GUI_TARGET.Size = UDim2.new(0,200,0,30)
  83. GUI_TARGET.BackgroundTransparency = 0.5
  84. GUI_TARGET.BackgroundColor = BrickColor.new('Fossil')
  85. GUI_TARGET.BorderSizePixel = 0
  86. GUI_TARGET.Position = UDim2.new(0.5,-100,0,0)
  87. GUI_TARGET.Text = 'AIMBOT : OFF'
  88. GUI_TARGET.TextColor3 = Color3.new(1,1,1)
  89. GUI_TARGET.TextStrokeTransparency = 1
  90. GUI_TARGET.TextWrapped = true
  91. GUI_TARGET.FontSize = 'Size24'
  92. GUI_TARGET.Font = 'GothamBold'
  93.  
  94. GUI_AIM_AT.Size = UDim2.new(0,200,0,20)
  95. GUI_AIM_AT.BackgroundTransparency = 0.5
  96. GUI_AIM_AT.BackgroundColor = BrickColor.new('Fossil')
  97. GUI_AIM_AT.BorderSizePixel = 0
  98. GUI_AIM_AT.Position = UDim2.new(0.5,-100,0,30)
  99. GUI_AIM_AT.Text = 'AIMING : TORSO'
  100. GUI_AIM_AT.TextColor3 = Color3.new(1,1,1)
  101. GUI_AIM_AT.TextStrokeTransparency = 1
  102. GUI_AIM_AT.TextWrapped = true
  103. GUI_AIM_AT.FontSize = 'Size18'
  104. GUI_AIM_AT.Font = 'Gotham'
  105.  
  106. local TRACK = false
  107.  
  108. function CREATE(BASE, TEAM)
  109. local ESP_MAIN = Instance.new('BillboardGui', PLAYER.PlayerGui)
  110. local ESP_DOT = Instance.new('Frame', ESP_MAIN)
  111. local ESP_NAME = Instance.new('TextLabel', ESP_MAIN)
  112.  
  113. ESP_MAIN.Name = 'ESP'
  114. ESP_MAIN.Adornee = BASE
  115. ESP_MAIN.AlwaysOnTop = true
  116. ESP_MAIN.ExtentsOffset = Vector3.new(0, 1, 0)
  117. ESP_MAIN.Size = UDim2.new(0, 5, 0, 5)
  118.  
  119. ESP_DOT.Name = 'DOT'
  120. ESP_DOT.BackgroundColor = BrickColor.new('Lime green')
  121. ESP_DOT.BackgroundTransparency = 0.3
  122. ESP_DOT.BorderSizePixel = 0
  123. ESP_DOT.Position = UDim2.new(-0.5, 0, -0.5, 0)
  124. ESP_DOT.Size = UDim2.new(2, 0, 2, 0)
  125. ESP_DOT.Visible = true
  126. ESP_DOT.ZIndex = 10
  127.  
  128. ESP_NAME.Name = 'NAME'
  129. ESP_NAME.BackgroundColor3 = Color3.new(255, 255, 255)
  130. ESP_NAME.BackgroundTransparency = 1
  131. ESP_NAME.BorderSizePixel = 0
  132. ESP_NAME.Position = UDim2.new(0, 0, 0, -40)
  133. ESP_NAME.Size = UDim2.new(1, 0, 10, 0)
  134. ESP_NAME.Visible = true
  135. ESP_NAME.ZIndex = 10
  136. ESP_NAME.Font = 'GothamBold'
  137. ESP_NAME.FontSize = 'Size14'
  138. ESP_NAME.Text = BASE.Parent.Name:upper()
  139. ESP_NAME.TextColor = BrickColor.new('Lime green')
  140. end
  141.  
  142. function CLEAR()
  143. for _,v in pairs(PLAYER.PlayerGui:children()) do
  144. if v.Name == 'ESP' and v:IsA('BillboardGui') then
  145. v:Destroy()
  146. end
  147. end
  148. end
  149.  
  150. function FIND()
  151. CLEAR()
  152. TRACK = true
  153. spawn(function()
  154. while wait() do
  155. if TRACK then
  156. CLEAR()
  157. for i,v in pairs(game.Players:GetChildren()) do
  158. if v.Character and v.Character:FindFirstChild('Head') then
  159. if _G.FREE_FOR_ALL == false then
  160. if v.TeamColor ~= PLAYER.TeamColor then
  161. if v.Character:FindFirstChild('Head') then
  162. CREATE(v.Character.Head, true)
  163. end
  164. end
  165. else
  166. if v.Character:FindFirstChild('Head') then
  167. CREATE(v.Character.Head, true)
  168. end
  169. end
  170. end
  171. end
  172. end
  173. end
  174. wait(1)
  175. end)
  176. end
  177.  
  178. MOUSE.KeyDown:connect(function(KEY)
  179. KEY = KEY:lower():byte()
  180. if KEY == _G.BIND then
  181. ENABLED = true
  182. end
  183. end)
  184.  
  185. MOUSE.KeyUp:connect(function(KEY)
  186. KEY = KEY:lower():byte()
  187. if KEY == _G.BIND then
  188. ENABLED = false
  189. end
  190. end)
  191.  
  192. MOUSE.KeyDown:connect(function(KEY)
  193. KEY = KEY:lower():byte()
  194. if KEY == _G.ESP_BIND then
  195. if ESP_ENABLED == false then
  196. FIND()
  197. ESP_ENABLED = true
  198. print('ESP : ON')
  199. elseif ESP_ENABLED == true then
  200. wait()
  201. CLEAR()
  202. TRACK = false
  203. ESP_ENABLED = true
  204. print('ESP : OFF')
  205. end
  206. end
  207. end)
  208.  
  209. MOUSE.KeyDown:connect(function(KEY)
  210. if KEY == _G.CHANGE_AIM then
  211. if _G.AIM_AT == 'Head' then
  212. _G.AIM_AT = 'Torso'
  213. GUI_AIM_AT.Text = 'AIMING : TORSO'
  214. elseif _G.AIM_AT == 'Torso' then
  215. _G.AIM_AT = 'Head'
  216. GUI_AIM_AT.Text = 'AIMING : HEAD'
  217. end
  218. end
  219. end)
  220.  
  221. game:GetService('RunService').RenderStepped:connect(function()
  222. if ENABLED then
  223. local TARGET = GetNearestPlayerToMouse()
  224. if (TARGET ~= false) then
  225. local AIM = TARGET.Character:FindFirstChild(_G.AIM_AT)
  226. if AIM then
  227. CC.CoordinateFrame = CFrame.new(CC.CoordinateFrame.p, AIM.CFrame.p)
  228. end
  229. GUI_TARGET.Text = 'AIMBOT : '.. TARGET.Name:sub(1, 5)
  230. else
  231. GUI_TARGET.Text = 'AIMBOT : OFF'
  232. end
  233. end
  234. end)
  235.  
  236. repeat
  237. wait()
  238. if ESP_ENABLED == true then
  239. FIND()
  240. end
  241. until ESP_ENABLED == false
  242. wait()
  243. _G.FREE_FOR_ALL = true
  244. _G.BIND = 50 -- LEFT CTRL
  245. _G.ESP_BIND = 52 -- LEFT ALT
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement