Advertisement
Jack12332

Aimbot

Aug 1st, 2023 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.51 KB | None | 0 0
  1. --// Preventing Multiple Processes
  2.  
  3. pcall(function()
  4. getgenv().Aimbot.Functions:Exit()
  5. end)
  6.  
  7. --// Environment
  8.  
  9. getgenv().Aimbot = {}
  10. local Environment = getgenv().Aimbot
  11.  
  12. --// Services
  13.  
  14. local RunService = game:GetService("RunService")
  15. local UserInputService = game:GetService("UserInputService")
  16. local HttpService = game:GetService("HttpService")
  17. local TweenService = game:GetService("TweenService")
  18. local StarterGui = game:GetService("StarterGui")
  19. local Players = game:GetService("Players")
  20. local Camera = game:GetService("Workspace").CurrentCamera
  21.  
  22. --// Variables
  23.  
  24. local LocalPlayer = Players.LocalPlayer
  25. local Title = "Exunys Developer"
  26. local FileNames = {"Aimbot", "Configuration.json", "Drawing.json"}
  27. local Typing, Running, Animation, RequiredDistance, ServiceConnections = false, false, nil, 2000, {}
  28.  
  29. --// Support Functions
  30.  
  31. local mousemoverel = mousemoverel or (Input and Input.MouseMove)
  32. local queueonteleport = queue_on_teleport or syn.queue_on_teleport
  33.  
  34. --// Script Settings
  35.  
  36. Environment.Settings = {
  37. SendNotifications = false,
  38. SaveSettings = true, -- Re-execute upon changing
  39. ReloadOnTeleport = true,
  40. Enabled = true,
  41. TeamCheck = false,
  42. AliveCheck = true,
  43. WallCheck = false, -- Laggy
  44. Sensitivity = 0, -- Animation length (in seconds) before fully locking onto target
  45. ThirdPerson = false, -- Uses mousemoverel instead of CFrame to support locking in third person (could be choppy)
  46. ThirdPersonSensitivity = 3, -- Boundary: 0.1 - 5
  47. TriggerKey = "MouseButton2",
  48. Toggle = false,
  49. LockPart = "Head" -- Body part to lock on
  50. }
  51.  
  52. Environment.FOVSettings = {
  53. Enabled = true,
  54. Visible = true,
  55. Amount = 90,
  56. Color = "255, 255, 255",
  57. LockedColor = "255, 70, 70",
  58. Transparency = 0.5,
  59. Sides = 60,
  60. Thickness = 1,
  61. Filled = false
  62. }
  63.  
  64. Environment.FOVCircle = Drawing.new("Circle")
  65. Environment.Locked = nil
  66.  
  67. --// Core Functions
  68.  
  69. local function Encode(Table)
  70. if Table and type(Table) == "table" then
  71. local EncodedTable = HttpService:JSONEncode(Table)
  72.  
  73. return EncodedTable
  74. end
  75. end
  76.  
  77. local function Decode(String)
  78. if String and type(String) == "string" then
  79. local DecodedTable = HttpService:JSONDecode(String)
  80.  
  81. return DecodedTable
  82. end
  83. end
  84.  
  85. local function GetColor(Color)
  86. local R = tonumber(string.match(Color, "([%d]+)[%s]*,[%s]*[%d]+[%s]*,[%s]*[%d]+"))
  87. local G = tonumber(string.match(Color, "[%d]+[%s]*,[%s]*([%d]+)[%s]*,[%s]*[%d]+"))
  88. local B = tonumber(string.match(Color, "[%d]+[%s]*,[%s]*[%d]+[%s]*,[%s]*([%d]+)"))
  89.  
  90. return Color3.fromRGB(R, G, B)
  91. end
  92.  
  93. local function SendNotification(TitleArg, DescriptionArg, DurationArg)
  94. if Environment.Settings.SendNotifications then
  95. StarterGui:SetCore("SendNotification", {
  96. Title = TitleArg,
  97. Text = DescriptionArg,
  98. Duration = DurationArg
  99. })
  100. end
  101. end
  102.  
  103. --// Functions
  104.  
  105. local function SaveSettings()
  106. if Environment.Settings.SaveSettings then
  107. if isfile(Title.."/"..FileNames[1].."/"..FileNames[2]) then
  108. writefile(Title.."/"..FileNames[1].."/"..FileNames[2], Encode(Environment.Settings))
  109. end
  110.  
  111. if isfile(Title.."/"..FileNames[1].."/"..FileNames[3]) then
  112. writefile(Title.."/"..FileNames[1].."/"..FileNames[3], Encode(Environment.FOVSettings))
  113. end
  114. end
  115. end
  116.  
  117. local function GetClosestPlayer()
  118. if not Environment.Locked then
  119. if Environment.FOVSettings.Enabled then
  120. RequiredDistance = Environment.FOVSettings.Amount
  121. else
  122. RequiredDistance = 2000
  123. end
  124.  
  125. for _, v in next, Players:GetPlayers() do
  126. if v ~= LocalPlayer then
  127. if v.Character and v.Character:FindFirstChild(Environment.Settings.LockPart) and v.Character:FindFirstChildOfClass("Humanoid") then
  128. if Environment.Settings.TeamCheck and v.Team == LocalPlayer.Team then continue end
  129. if Environment.Settings.AliveCheck and v.Character:FindFirstChildOfClass("Humanoid").Health <= 0 then continue end
  130. if Environment.Settings.WallCheck and #(Camera:GetPartsObscuringTarget({v.Character[Environment.Settings.LockPart].Position}, v.Character:GetDescendants())) > 0 then continue end
  131.  
  132. local Vector, OnScreen = Camera:WorldToViewportPoint(v.Character[Environment.Settings.LockPart].Position)
  133. local Distance = (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(Vector.X, Vector.Y)).Magnitude
  134.  
  135. if Distance < RequiredDistance and OnScreen then
  136. RequiredDistance = Distance
  137. Environment.Locked = v
  138. end
  139. end
  140. end
  141. end
  142. elseif (Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y) - Vector2.new(Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position).X, Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position).Y)).Magnitude > RequiredDistance then
  143. Environment.Locked = nil
  144. Animation:Cancel()
  145. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  146. end
  147. end
  148.  
  149. --// Typing Check
  150.  
  151. ServiceConnections.TypingStartedConnection = UserInputService.TextBoxFocused:Connect(function()
  152. Typing = true
  153. end)
  154.  
  155. ServiceConnections.TypingEndedConnection = UserInputService.TextBoxFocusReleased:Connect(function()
  156. Typing = false
  157. end)
  158.  
  159. --// Create, Save & Load Settings
  160.  
  161. if Environment.Settings.SaveSettings then
  162. if not isfolder(Title) then
  163. makefolder(Title)
  164. end
  165.  
  166. if not isfolder(Title.."/"..FileNames[1]) then
  167. makefolder(Title.."/"..FileNames[1])
  168. end
  169.  
  170. if not isfile(Title.."/"..FileNames[1].."/"..FileNames[2]) then
  171. writefile(Title.."/"..FileNames[1].."/"..FileNames[2], Encode(Environment.Settings))
  172. else
  173. Environment.Settings = Decode(readfile(Title.."/"..FileNames[1].."/"..FileNames[2]))
  174. end
  175.  
  176. if not isfile(Title.."/"..FileNames[1].."/"..FileNames[3]) then
  177. writefile(Title.."/"..FileNames[1].."/"..FileNames[3], Encode(Environment.FOVSettings))
  178. else
  179. Environment.Visuals = Decode(readfile(Title.."/"..FileNames[1].."/"..FileNames[3]))
  180. end
  181.  
  182. coroutine.wrap(function()
  183. while wait(10) and Environment.Settings.SaveSettings do
  184. SaveSettings()
  185. end
  186. end)()
  187. else
  188. if isfolder(Title) then
  189. delfolder(Title)
  190. end
  191. end
  192.  
  193. local function Load()
  194. ServiceConnections.RenderSteppedConnection = RunService.RenderStepped:Connect(function()
  195. if Environment.FOVSettings.Enabled and Environment.Settings.Enabled then
  196. Environment.FOVCircle.Radius = Environment.FOVSettings.Amount
  197. Environment.FOVCircle.Thickness = Environment.FOVSettings.Thickness
  198. Environment.FOVCircle.Filled = Environment.FOVSettings.Filled
  199. Environment.FOVCircle.NumSides = Environment.FOVSettings.Sides
  200. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  201. Environment.FOVCircle.Transparency = Environment.FOVSettings.Transparency
  202. Environment.FOVCircle.Visible = Environment.FOVSettings.Visible
  203. Environment.FOVCircle.Position = Vector2.new(UserInputService:GetMouseLocation().X, UserInputService:GetMouseLocation().Y)
  204. else
  205. Environment.FOVCircle.Visible = false
  206. end
  207.  
  208. if Running and Environment.Settings.Enabled then
  209. GetClosestPlayer()
  210.  
  211. if Environment.Settings.ThirdPerson then
  212. Environment.Settings.ThirdPersonSensitivity = math.clamp(Environment.Settings.ThirdPersonSensitivity, 0.1, 5)
  213.  
  214. local Vector = Camera:WorldToViewportPoint(Environment.Locked.Character[Environment.Settings.LockPart].Position)
  215. mousemoverel((Vector.X - UserInputService:GetMouseLocation().X) * Environment.Settings.ThirdPersonSensitivity, (Vector.Y - UserInputService:GetMouseLocation().Y) * Environment.Settings.ThirdPersonSensitivity)
  216. else
  217. if Environment.Settings.Sensitivity > 0 then
  218. Animation = TweenService:Create(Camera, TweenInfo.new(Environment.Settings.Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Camera.CFrame.Position, Environment.Locked.Character[Environment.Settings.LockPart].Position)})
  219. Animation:Play()
  220. else
  221. Camera.CFrame = CFrame.new(Camera.CFrame.Position, Environment.Locked.Character[Environment.Settings.LockPart].Position)
  222. end
  223. end
  224.  
  225. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.LockedColor)
  226. end
  227. end)
  228.  
  229. ServiceConnections.InputBeganConnection = UserInputService.InputBegan:Connect(function(Input)
  230. if not Typing then
  231. pcall(function()
  232. if Input.KeyCode == Enum.KeyCode[Environment.Settings.TriggerKey] then
  233. if Environment.Settings.Toggle then
  234. Running = not Running
  235.  
  236. if not Running then
  237. Environment.Locked = nil
  238. Animation:Cancel()
  239. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  240. end
  241. else
  242. Running = true
  243. end
  244. end
  245. end)
  246.  
  247. pcall(function()
  248. if Input.UserInputType == Enum.UserInputType[Environment.Settings.TriggerKey] then
  249. if Environment.Settings.Toggle then
  250. Running = not Running
  251.  
  252. if not Running then
  253. Environment.Locked = nil
  254. Animation:Cancel()
  255. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  256. end
  257. else
  258. Running = true
  259. end
  260. end
  261. end)
  262. end
  263. end)
  264.  
  265. ServiceConnections.InputEndedConnection = UserInputService.InputEnded:Connect(function(Input)
  266. if not Typing then
  267. pcall(function()
  268. if Input.KeyCode == Enum.KeyCode[Environment.Settings.TriggerKey] then
  269. if not Environment.Settings.Toggle then
  270. Running = false
  271. Environment.Locked = nil
  272. Animation:Cancel()
  273. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  274. end
  275. end
  276. end)
  277.  
  278. pcall(function()
  279. if Input.UserInputType == Enum.UserInputType[Environment.Settings.TriggerKey] then
  280. if not Environment.Settings.Toggle then
  281. Running = false
  282. Environment.Locked = nil
  283. Animation:Cancel()
  284. Environment.FOVCircle.Color = GetColor(Environment.FOVSettings.Color)
  285. end
  286. end
  287. end)
  288. end
  289. end)
  290. end
  291.  
  292. --// Functions
  293.  
  294. Environment.Functions = {}
  295.  
  296. function Environment.Functions:Exit()
  297. SaveSettings()
  298.  
  299. for _, v in next, ServiceConnections do
  300. v:Disconnect()
  301. end
  302.  
  303. if Environment.FOVCircle.Remove then Environment.FOVCircle:Remove() end
  304.  
  305. getgenv().Aimbot.Functions = nil
  306. getgenv().Aimbot = nil
  307. end
  308.  
  309. function Environment.Functions:Restart()
  310. SaveSettings()
  311.  
  312. for _, v in next, ServiceConnections do
  313. v:Disconnect()
  314. end
  315.  
  316. Load()
  317. end
  318.  
  319. function Environment.Functions:ResetSettings()
  320. Environment.Settings = {
  321. SendNotifications = true,
  322. SaveSettings = true, -- Re-execute upon changing
  323. ReloadOnTeleport = true,
  324. Enabled = true,
  325. TeamCheck = false,
  326. AliveCheck = true,
  327. WallCheck = false,
  328. Sensitivity = 0, -- Animation length (in seconds) before fully locking onto target
  329. ThirdPerson = false,
  330. ThirdPersonSensitivity = 3,
  331. TriggerKey = "MouseButton2",
  332. Toggle = false,
  333. LockPart = "Head" -- Body part to lock on
  334. }
  335.  
  336. Environment.FOVSettings = {
  337. Enabled = true,
  338. Visible = true,
  339. Amount = 90,
  340. Color = "255, 255, 255",
  341. LockedColor = "255, 70, 70",
  342. Transparency = 0.5,
  343. Sides = 60,
  344. Thickness = 1,
  345. Filled = false
  346. }
  347. end
  348.  
  349. --// Support Check
  350.  
  351. if not Drawing or not getgenv then
  352. SendNotification(Title, "Your exploit does not support this script", 3); return
  353. end
  354.  
  355. --// Reload On Teleport
  356.  
  357. if Environment.Settings.ReloadOnTeleport then
  358. if queueonteleport then
  359. queueonteleport(game:HttpGet("https://raw.githubusercontent.com/Exunys/Aimbot-V2/main/Resources/Scripts/Main.lua"))
  360. else
  361. SendNotification(Title, "Your exploit does not support \"syn.queue_on_teleport()\"")
  362. end
  363. end
  364.  
  365. --// Load
  366.  
  367. Load(); SendNotification(Title, "Aimbot script successfully loaded! Thanks for buying!", 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement