Advertisement
RandomExploiter23

Universal Aimlock

Oct 24th, 2023
1,487
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.24 KB | None | 0 1
  1. local plrs = game:GetService("Players")
  2. local TeamBased = true ; local teambasedswitch = "o"
  3. local presskeytoaim = true; local aimkey = "e"
  4. local raycast = false
  5.  
  6. local espupdatetime = 5; autoesp = false
  7.  
  8.  
  9.  
  10. local lockaim = true; local lockangle = 5
  11.  
  12.  
  13. local Gui = Instance.new("ScreenGui")
  14. local Move = Instance.new("Frame")
  15. local Main = Instance.new("Frame")
  16. local EspStatus = Instance.new("TextLabel")
  17. local st1 = Instance.new("TextLabel")
  18. local st1_2 = Instance.new("TextLabel")
  19. local st1_3 = Instance.new("TextLabel")
  20. local Name = Instance.new("TextLabel")
  21.  
  22.  
  23. Gui.Name = "Gui"
  24. Gui.Parent = plrs.LocalPlayer:WaitForChild("PlayerGui")
  25.  
  26. Move.Name = "Move"
  27. Move.Parent = Gui
  28. Move.BackgroundColor3 = Color3.new(0.0431373, 1, 0.0745098)
  29. Move.BackgroundTransparency = 1
  30. Move.BorderSizePixel = 0
  31. Move.Position = UDim2.new(0, 0,0, 0)
  32. Move.Size = UDim2.new(0, 0, 0, 0)
  33.  
  34. Main.Name = "Main"
  35. Main.Parent = Move
  36. Main.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  37. Main.BackgroundTransparency = 1
  38. Main.Position = UDim2.new(0, 0, 0.995670795, 0)
  39. Main.Size = UDim2.new(0, 0, 0, 0)
  40.  
  41. EspStatus.Name = "EspStatus"
  42. EspStatus.Parent = Main
  43. EspStatus.BackgroundColor3 = Color3.new(1, 1, 1)
  44. EspStatus.BackgroundTransparency = 1
  45. EspStatus.Size = UDim2.new(0.272955924, 0, 0.161862016, 0)
  46. EspStatus.Font = Enum.Font.ArialBold
  47. EspStatus.Text = "Press T to update Esp"
  48. EspStatus.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  49. EspStatus.TextScaled = true
  50. EspStatus.TextSize = 0
  51. EspStatus.TextWrapped = true
  52.  
  53. st1.Name = "st1"
  54. st1.Parent = Main
  55. st1.BackgroundColor3 = Color3.new(1, 1, 1)
  56. st1.BackgroundTransparency = 1
  57. st1.Position = UDim2.new(0.271787882, 0, 0, 0)
  58. st1.Size = UDim2.new(0, 0, 0, 0)
  59. st1.Font = Enum.Font.ArialBold
  60. st1.Text = "Press "..aimkey.." to lock on a person inside ur view"
  61. st1.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  62. st1.TextScaled = true
  63. st1.TextSize = 0
  64. st1.TextWrapped = true
  65.  
  66. st1_2.Name = "st1"
  67. st1_2.Parent = Main
  68. st1_2.BackgroundColor3 = Color3.new(1, 1, 1)
  69. st1_2.BackgroundTransparency = 1
  70. st1_2.Position = UDim2.new(0, 0, 0, 0)
  71. st1_2.Size = UDim2.new(0, 0, 0, 0)
  72. st1_2.Font = Enum.Font.ArialBold
  73. st1_2.Text = "Press L to enable esp loop"
  74. st1_2.TextColor3 = Color3.new(0.0431373, 1, 0.0745098)
  75. st1_2.TextScaled = true
  76. st1_2.TextSize = 0
  77. st1_2.TextWrapped = true
  78.  
  79. st1_3.Name = "st1"
  80. st1_3.Parent = Main
  81. st1_3.BackgroundColor3 = Color3.new(1, 1, 1)
  82. st1_3.BackgroundTransparency = 1
  83. st1_3.Position = UDim2.new(0, 0, 0, 0)
  84. st1_3.Size = UDim2.new(0, 0, 0, 0)
  85. st1_3.Font = Enum.Font.ArialBold
  86. st1_3.Text = "Press O to change team based mode"
  87. st1_3.TextColor3 = Color3.new(0, 1, 0)
  88. st1_3.TextScaled = true
  89. st1_3.TextSize = 0
  90. st1_3.TextWrapped = true
  91. local teambasedstatus = st1_3:Clone()
  92. teambasedstatus.Parent = st1_3
  93. teambasedstatus.TextScaled = true
  94. teambasedstatus.Position = UDim2.new(0, 0,0.694, 0)
  95. teambasedstatus.Text = tostring(TeamBased)
  96.  
  97. Name.Name = "Name"
  98. Name.Parent = Move
  99. Name.BackgroundColor3 = Color3.new(1, 1, 1)
  100. Name.BackgroundTransparency = 1
  101. Name.Size = UDim2.new(0, 0, 0, 0)
  102. Name.Font = Enum.Font.Arial
  103. Name.Text = "FPS gui v1.0"
  104. Name.TextColor3 = Color3.new(0, 0, 0)
  105. Name.TextScaled = true
  106. Name.TextSize = 0
  107. Name.TextWrapped = true
  108. Name.TextXAlignment = Enum.TextXAlignment.Left
  109. -- Scripts:
  110.  
  111.  
  112. local plrsforaim = {}
  113.  
  114. local lplr = game:GetService("Players").LocalPlayer
  115. Move.Draggable = true
  116. Gui.ResetOnSpawn = false
  117. Gui.Name = "Chat"
  118. Gui.DisplayOrder = 999
  119.  
  120. Gui.Parent = plrs.LocalPlayer.PlayerGui
  121.  
  122.  
  123. f = {}
  124. local espforlder
  125.  
  126. f.addesp = function()
  127. if espforlder then
  128. else
  129. espforlder = Instance.new("Folder")
  130. espforlder.Parent = game.Workspace.CurrentCamera
  131. end
  132. for i, v in pairs(espforlder:GetChildren()) do
  133. v:Destroy()
  134. end
  135. for _, plr in pairs(plrs:GetChildren()) do
  136. if plr.Character and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name then
  137. if TeamBased == true then
  138. if plr.Team.Name ~= plrs.LocalPlayer.Team.Name then
  139. local e = espforlder:FindFirstChild(plr.Name)
  140. if not e then
  141. --print("Added esp for team based")
  142. local bill = Instance.new("BillboardGui", espforlder)
  143. bill.Name = plr.Name
  144. bill.AlwaysOnTop = true
  145. bill.Size = UDim2.new(1,0,1,0)
  146. bill.Adornee = plr.Character.Head
  147. local Frame = Instance.new('Frame',bill)
  148. Frame.Active = true
  149. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  150. Frame.BackgroundTransparency = 0
  151. Frame.BorderSizePixel = 0
  152. Frame.AnchorPoint = Vector2.new(.5, .5)
  153. Frame.Position = UDim2.new (0.5,0,0.5,0)
  154. Frame.Size = UDim2.new (1,0,1,0)
  155. Frame.Rotation = 0
  156. plr.Character.Humanoid.Died:Connect(function()
  157. bill:Destroy()
  158. end)
  159. end
  160. end
  161. else
  162. local e = espforlder:FindFirstChild(plr.Name)
  163. if not e then
  164. --print("Added esp")
  165. local bill = Instance.new("BillboardGui", espforlder)
  166. bill.Name = plr.Name
  167. bill.AlwaysOnTop = true
  168. bill.Size = UDim2.new(1,0,1,0)
  169. bill.Adornee = plr.Character.Head
  170. local Frame = Instance.new('Frame',bill)
  171. Frame.Active = true
  172. Frame.BackgroundColor3 = Color3.new(0/255,255/255,0/255)
  173. Frame.BackgroundTransparency = 0
  174. Frame.BorderSizePixel = 0
  175. Frame.AnchorPoint = Vector2.new(.5, .5)
  176. Frame.Position = UDim2.new (0.5,0,0.5,0)
  177. Frame.Size = UDim2.new (1,0,1,0)
  178. Frame.Rotation = 0
  179. plr.Character.Humanoid.Died:Connect(function()
  180. bill:Destroy()
  181. end)
  182. end
  183. end
  184.  
  185.  
  186. end
  187. end
  188. end
  189. local cam = game.Workspace.CurrentCamera
  190.  
  191. local mouse = lplr:GetMouse()
  192. local switch = false
  193. local key = "k"
  194. local aimatpart = nil
  195. mouse.KeyDown:Connect(function(a)
  196. if a == "t" then
  197. print("worked1")
  198. f.addesp()
  199. elseif a == "u" then
  200. if raycast == true then
  201. raycast = false
  202. else
  203. raycast = true
  204. end
  205. elseif a == "l" then
  206. if autoesp == false then
  207. autoesp = true
  208. else
  209. autoesp = false
  210. end
  211. end
  212. if a == "j" then
  213. if mouse.Target then
  214. mouse.Target:Destroy()
  215. end
  216. end
  217. if a == key then
  218. if switch == false then
  219. switch = true
  220. else
  221. switch = false
  222. if aimatpart ~= nil then
  223. aimatpart = nil
  224. end
  225. end
  226. elseif a == teambasedswitch then
  227. if TeamBased == true then
  228. TeamBased = false
  229. teambasedstatus.Text = tostring(TeamBased)
  230. else
  231. TeamBased = true
  232. teambasedstatus.Text = tostring(TeamBased)
  233. end
  234. elseif a == aimkey then
  235. if not aimatpart then
  236. local maxangle = math.rad(20)
  237. for i, plr in pairs(plrs:GetChildren()) do
  238. if plr.Name ~= lplr.Name and plr.Character and plr.Character.Head and plr.Character.Humanoid and plr.Character.Humanoid.Health > 1 then
  239. if TeamBased == true then
  240. if plr.Team.Name ~= lplr.Team.Name then
  241. local an = checkfov(plr.Character.Head)
  242. if an < maxangle then
  243. maxangle = an
  244. aimatpart = plr.Character.Head
  245. end
  246. end
  247. else
  248. local an = checkfov(plr.Character.Head)
  249. if an < maxangle then
  250. maxangle = an
  251. aimatpart = plr.Character.Head
  252. end
  253. print(plr)
  254. end
  255. plr.Character.Humanoid.Died:Connect(function()
  256. if aimatpart.Parent == plr.Character or aimatpart == nil then
  257. aimatpart = nil
  258. end
  259. end)
  260. end
  261. end
  262. else
  263. aimatpart = nil
  264. end
  265. end
  266. end)
  267.  
  268. function getfovxyz (p0, p1, deg)
  269. local x1, y1, z1 = p0:ToOrientation()
  270. local cf = CFrame.new(p0.p, p1.p)
  271. local x2, y2, z2 = cf:ToOrientation()
  272. --local d = math.deg
  273. if deg then
  274. --return Vector3.new(d(x1-x2), d(y1-y2), d(z1-z2))
  275. else
  276. return Vector3.new((x1-x2), (y1-y2), (z1-z2))
  277. end
  278. end
  279.  
  280. function getaimbotplrs()
  281. plrsforaim = {}
  282. for i, plr in pairs(plrs:GetChildren()) do
  283. if plr.Character and plr.Character.Humanoid and plr.Character.Humanoid.Health > 0 and plr.Name ~= lplr.Name and plr.Character.Head then
  284.  
  285. if TeamBased == true then
  286. if plr.Team.Name ~= lplr.Team.Name then
  287. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  288. local r = Ray.new(cf, cf.LookVector * 10000)
  289. local ign = {}
  290. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  291. if v:IsA("BasePart") then
  292. table.insert(ign , v)
  293. end
  294. end
  295. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  296. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  297. table.insert(plrsforaim, obj)
  298. end
  299. end
  300. else
  301. local cf = CFrame.new(game.Workspace.CurrentCamera.CFrame.p, plr.Character.Head.CFrame.p)
  302. local r = Ray.new(cf, cf.LookVector * 10000)
  303. local ign = {}
  304. for i, v in pairs(plrs.LocalPlayer.Character:GetChildren()) do
  305. if v:IsA("BasePart") then
  306. table.insert(ign , v)
  307. end
  308. end
  309. local obj = game.Workspace:FindPartOnRayWithIgnoreList(r, ign)
  310. if obj.Parent == plr.Character and obj.Parent ~= lplr.Character then
  311. table.insert(plrsforaim, obj)
  312. end
  313. end
  314.  
  315.  
  316. end
  317. end
  318. end
  319.  
  320. function aimat(part)
  321. cam.CFrame = CFrame.new(cam.CFrame.p, part.CFrame.p)
  322. end
  323. function checkfov (part)
  324. local fov = getfovxyz(game.Workspace.CurrentCamera.CFrame, part.CFrame)
  325. local angle = math.abs(fov.X) + math.abs(fov.Y)
  326. return angle
  327. end
  328.  
  329. game:GetService("RunService").RenderStepped:Connect(function()
  330. if aimatpart then
  331. aimat(aimatpart)
  332. if aimatpart.Parent == plrs.LocalPlayer.Character then
  333. aimatpart = nil
  334. end
  335. end
  336.  
  337.  
  338. if raycast == true and switch == false and not aimatpart then
  339. getaimbotplrs()
  340. aimatpart = nil
  341. local maxangle = 999
  342. for i, v in ipairs(plrsforaim) do
  343. if v.Parent ~= lplr.Character then
  344. local an = checkfov(v)
  345. if an < maxangle and v ~= lplr.Character.Head then
  346. maxangle = an
  347. aimatpart = v
  348. print(v:GetFullName())
  349. v.Parent.Humanoid.Died:connect(function()
  350. aimatpart = nil
  351. end)
  352. end
  353. end
  354. end
  355.  
  356. end
  357. end)
  358. delay(0, function()
  359. while wait(espupdatetime) do
  360. if autoesp == true then
  361. pcall(function()
  362. f.addesp()
  363. end)
  364. end
  365. end
  366. end)
  367. warn("loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement