Advertisement
Jack12332

aimbot

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