Advertisement
oigfngfdgfdgfd

Untitled

Aug 15th, 2022 (edited)
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.22 KB | None | 0 0
  1. -- // New version: See ./Aiming/SilentAim.lua
  2.  
  3. if getgenv().ValiantAimHacks then return getgenv().ValiantAimHacks end
  4.  
  5. -- // Services
  6. local Players = game:GetService("Players")
  7. local Workspace = game:GetService("Workspace")
  8. local GuiService = game:GetService("GuiService")
  9. local RunService = game:GetService("RunService")
  10.  
  11. -- // Vars
  12. local Heartbeat = RunService.Heartbeat
  13. local LocalPlayer = Players.LocalPlayer
  14. local CurrentCamera = Workspace.CurrentCamera
  15. local Mouse = LocalPlayer:GetMouse()
  16.  
  17. -- // Optimisation Vars (ugly)
  18. local Drawingnew = Drawing.new
  19. local Color3fromRGB = Color3.fromRGB
  20. local Vector2new = Vector2.new
  21. local GetGuiInset = GuiService.GetGuiInset
  22. local Randomnew = Random.new
  23. local mathfloor = math.floor
  24. local CharacterAdded = LocalPlayer.CharacterAdded
  25. local CharacterAddedWait = CharacterAdded.Wait
  26. local WorldToViewportPoint = CurrentCamera.WorldToViewportPoint
  27. local RaycastParamsnew = RaycastParams.new
  28. local EnumRaycastFilterTypeBlacklist = Enum.RaycastFilterType.Blacklist
  29. local Raycast = Workspace.Raycast
  30. local GetPlayers = Players.GetPlayers
  31. local Instancenew = Instance.new
  32. local IsDescendantOf = Instancenew("Part").IsDescendantOf
  33. local FindFirstChildWhichIsA = Instancenew("Part").FindFirstChildWhichIsA
  34. local FindFirstChild = Instancenew("Part").FindFirstChild
  35.  
  36. -- // Silent Aim Vars
  37. getgenv().ValiantAimHacks = {
  38. SilentAimEnabled = true,
  39. ShowFOV = true,
  40. FOVSides = 12,
  41. VisibleCheck = true,
  42. TeamCheck = true,
  43. FOV = 15,
  44. HitChance = 110,
  45. Selected = LocalPlayer,
  46. SelectedPart = nil,
  47. TargetPart = {"Head", "UpperTorso", "LowerTorso", "HumanoidRootPart", "RightFoot", "LeftFoot", "RightUpperArm", "RightLowerArm", "LeftUpperArm", "LeftLowerArm", "LeftLowerLeg", "LeftUpperLeg", "RightUpperLeg", "RightLowerLeg", "RightHand", "LeftHand"},
  48. BlacklistedTeams = {
  49. {
  50. Team = LocalPlayer.Team,
  51. TeamColor = LocalPlayer.TeamColor,
  52. },
  53. },
  54. BlacklistedPlayers = {LocalPlayer},
  55. WhitelistedPUIDs = {91318356},
  56. }
  57. local ValiantAimHacks = getgenv().ValiantAimHacks
  58.  
  59. -- // Show FOV
  60. local circle = Drawingnew("Circle")
  61. circle.Transparency = 1
  62. circle.Thickness = 2
  63. circle.Color = Color3fromRGB(231, 84, 128)
  64. circle.Filled = false
  65. function ValiantAimHacks.updateCircle()
  66. if (circle) then
  67. -- // Set Circle Properties
  68. circle.Visible = ValiantAimHacks.ShowFOV
  69. circle.Radius = (ValiantAimHacks.FOV * 3)
  70. circle.Position = Vector2new(Mouse.X, Mouse.Y + GetGuiInset(GuiService).Y)
  71. circle.NumSides = ValiantAimHacks.FOVSides
  72.  
  73. -- // Return circle
  74. return circle
  75. end
  76. end
  77.  
  78. -- // Custom Functions
  79. local calcChance = function(percentage)
  80. percentage = mathfloor(percentage)
  81. local chance = mathfloor(Randomnew().NextNumber(Randomnew(), 0, 1) * 100) / 100
  82. return chance <= percentage / 100
  83. end
  84.  
  85. -- // Customisable Checking Functions: Is a part visible
  86. function ValiantAimHacks.isPartVisible(Part, PartDescendant)
  87. -- // Vars
  88. local Character = LocalPlayer.Character or CharacterAddedWait(CharacterAdded)
  89. local Origin = CurrentCamera.CFrame.Position
  90. local _, OnScreen = WorldToViewportPoint(CurrentCamera, Part.Position)
  91.  
  92. -- // If Part is on the screen
  93. if (OnScreen) then
  94. -- // Vars: Calculating if is visible
  95. local raycastParams = RaycastParamsnew()
  96. raycastParams.FilterType = EnumRaycastFilterTypeBlacklist
  97. raycastParams.FilterDescendantsInstances = {Character, CurrentCamera}
  98.  
  99. local Result = Raycast(Workspace, Origin, Part.Position - Origin, raycastParams)
  100. if (Result) then
  101. local PartHit = Result.Instance
  102. local Visible = (not PartHit or IsDescendantOf(PartHit, PartDescendant))
  103.  
  104. -- // Return
  105. return Visible
  106. end
  107. end
  108.  
  109. -- // Return
  110. return false
  111. end
  112.  
  113. -- // Check teams
  114. function ValiantAimHacks.checkTeam(targetPlayerA, targetPlayerB)
  115. -- // If player is not on your team
  116. if (targetPlayerA.Team ~= targetPlayerB.Team) then
  117.  
  118. -- // Check if team is blacklisted
  119. for i = 1, #ValiantAimHacks.BlacklistedTeams do
  120. local v = ValiantAimHacks.BlacklistedTeams
  121.  
  122. if (targetPlayerA.Team ~= v.Team and targetPlayerA.TeamColor ~= v.TeamColor) then
  123. return true
  124. end
  125. end
  126. end
  127.  
  128. -- // Return
  129. return false
  130. end
  131.  
  132. -- // Check if player is blacklisted
  133. function ValiantAimHacks.checkPlayer(targetPlayer)
  134. for i = 1, #ValiantAimHacks.BlacklistedPlayers do
  135. local v = ValiantAimHacks.BlacklistedPlayers[i]
  136.  
  137. if (v ~= targetPlayer) then
  138. return true
  139. end
  140. end
  141.  
  142. -- // Return
  143. return false
  144. end
  145.  
  146. -- // Check if player is whitelisted
  147. function ValiantAimHacks.checkWhitelisted(targetPlayer)
  148. for i = 1, #ValiantAimHacks.WhitelistedPUIDs do
  149. local v = ValiantAimHacks.WhitelistedPUIDs[i]
  150.  
  151. if (targetPlayer.UserId == v) then
  152. return true
  153. end
  154. end
  155.  
  156. -- // Return
  157. return false
  158. end
  159.  
  160. -- // Blacklist player
  161. function ValiantAimHacks.BlacklistPlayer(Player)
  162. local BlacklistedPlayers = ValiantAimHacks.BlacklistedPlayers
  163.  
  164. -- // Find player in table
  165. for i = 1, #BlacklistedPlayers do
  166. local BlacklistedPlayer = BlacklistedPlayers[i]
  167.  
  168. if (BlacklistedPlayer == Player) then
  169. return false
  170. end
  171. end
  172.  
  173. -- // Blacklist player
  174. BlacklistedPlayers[#BlacklistedPlayers + 1] = Player
  175. return true
  176. end
  177.  
  178. -- // Unblacklist Player
  179. function ValiantAimHacks.UnblacklistPlayer(Player)
  180. local BlacklistedPlayers = ValiantAimHacks.BlacklistedPlayers
  181.  
  182. -- // Find player in table
  183. for i = 1, #BlacklistedPlayers do
  184. local BlacklistedPlayer = BlacklistedPlayers[i]
  185.  
  186. if (BlacklistedPlayer == Player) then
  187. table.remove(BlacklistedPlayer, i)
  188. return true
  189. end
  190. end
  191.  
  192. -- //
  193. return false
  194. end
  195.  
  196. -- // Whitelist player
  197. function ValiantAimHacks.WhitelistPlayer(PlayerId)
  198. local WhitelistedPUIDs = ValiantAimHacks.WhitelistedPUIDs
  199.  
  200. -- // Find player in table
  201. for i = 1, #WhitelistedPUIDs do
  202. local WhitelistedPUID = WhitelistedPUIDs[i]
  203.  
  204. if (WhitelistedPUID == PlayerId) then
  205. return false
  206. end
  207. end
  208.  
  209. -- // Whitelist player
  210. WhitelistedPUIDs[#WhitelistedPUIDs + 1] = PlayerId
  211. return true
  212. end
  213.  
  214. -- // Unwhitelist Player
  215. function ValiantAimHacks.UnwhitelistPlayer(PlayerId)
  216. local WhitelistedPUIDs = ValiantAimHacks.WhitelistedPUIDs
  217.  
  218. -- // Find player in table
  219. for i = 1, #WhitelistedPUIDs do
  220. local WhitelistedPUID = WhitelistedPUIDs[i]
  221.  
  222. if (WhitelistedPUID == PlayerId) then
  223. table.remove(WhitelistedPUID, i)
  224. return true
  225. end
  226. end
  227.  
  228. -- //
  229. return false
  230. end
  231.  
  232. -- // Get the Direction, Normal and Material
  233. function ValiantAimHacks.findDirectionNormalMaterial(Origin, Destination, UnitMultiplier)
  234. if (typeof(Origin) == "Vector3" and typeof(Destination) == "Vector3") then
  235. -- // Handling
  236. if (not UnitMultiplier) then UnitMultiplier = 1 end
  237.  
  238. -- // Vars
  239. local Direction = (Destination - Origin).Unit * UnitMultiplier
  240. local RaycastResult = Raycast(Workspace, Origin, Direction)
  241.  
  242. if (RaycastResult ~= nil) then
  243. local Normal = RaycastResult.Normal
  244. local Material = RaycastResult.Material
  245.  
  246. return Direction, Normal, Material
  247. end
  248. end
  249.  
  250. -- // Return
  251. return nil
  252. end
  253.  
  254. -- // Get Character
  255. function ValiantAimHacks.getCharacter(Player)
  256. return Player.Character
  257. end
  258.  
  259. -- // Check Health
  260. function ValiantAimHacks.checkHealth(Player)
  261. local Character = ValiantAimHacks.getCharacter(Player)
  262. local Humanoid = FindFirstChildWhichIsA(Character, "Humanoid")
  263.  
  264. local Health = (Humanoid and Humanoid.Health or 0)
  265. return Health > 0
  266. end
  267.  
  268. -- // Check if silent aim can used
  269. function ValiantAimHacks.checkSilentAim()
  270. return (ValiantAimHacks.SilentAimEnabled == true and ValiantAimHacks.Selected ~= LocalPlayer and ValiantAimHacks.SelectedPart ~= nil)
  271. end
  272.  
  273. -- // Get Closest Target Part
  274. function ValiantAimHacks.getClosestTargetPartToCursor(Character)
  275. local TargetParts = ValiantAimHacks.TargetPart
  276.  
  277. -- // Vars
  278. local ClosestPart = nil
  279. local ClosestPartPosition = nil
  280. local ClosestPartOnScreen = false
  281. local ClosestPartMagnitudeFromMouse = nil
  282. local ShortestDistance = 1/0
  283.  
  284. -- //
  285. local function checkTargetPart(TargetPartName)
  286. local TargetPart = FindFirstChild(Character, TargetPartName)
  287.  
  288. if (TargetPart) then
  289. local PartPos, onScreen = WorldToViewportPoint(CurrentCamera, TargetPart.Position)
  290. local Magnitude = (Vector2new(PartPos.X, PartPos.Y) - Vector2new(Mouse.X, Mouse.Y)).Magnitude
  291.  
  292. if (Magnitude < ShortestDistance) then
  293. ClosestPart = TargetPart
  294. ClosestPartPosition = PartPos
  295. ClosestPartOnScreen = onScreen
  296. ClosestPartMagnitudeFromMouse = Magnitude
  297. ShortestDistance = Magnitude
  298. end
  299. end
  300. end
  301.  
  302. -- // String check
  303. if (typeof(TargetParts) == "string") then
  304. checkTargetPart(TargetParts)
  305. end
  306.  
  307. -- // Loop through all target parts
  308. if (typeof(TargetParts) == "table") then
  309. for i = 1, #TargetParts do
  310. local TargetPartName = TargetParts[i]
  311. checkTargetPart(TargetPartName)
  312. end
  313. end
  314.  
  315. -- //
  316. return ClosestPart, ClosestPartPosition, ClosestPartOnScreen, ClosestPartMagnitudeFromMouse
  317. end
  318.  
  319. -- // Silent Aim Function
  320. function ValiantAimHacks.getClosestPlayerToCursor()
  321. -- // Vars
  322. local TargetPart = nil
  323. local ClosestPlayer = nil
  324. local Chance = calcChance(ValiantAimHacks.HitChance)
  325. local ShortestDistance = 1/0
  326.  
  327. -- // Chance
  328. if (not Chance) then
  329. ValiantAimHacks.Selected = LocalPlayer
  330. ValiantAimHacks.SelectedPart = nil
  331.  
  332. return LocalPlayer
  333. end
  334.  
  335. -- // Loop through all players
  336. local AllPlayers = GetPlayers(Players)
  337. for i = 1, #AllPlayers do
  338. local Player = AllPlayers[i]
  339. local Character = ValiantAimHacks.getCharacter(Player)
  340.  
  341. if (not ValiantAimHacks.checkWhitelisted(Player) and ValiantAimHacks.checkPlayer(Player) and Character) then
  342. local TargetPartTemp, PartPos, onScreen, Magnitude = ValiantAimHacks.getClosestTargetPartToCursor(Character)
  343.  
  344. if (TargetPartTemp and ValiantAimHacks.checkHealth(Player)) then
  345. -- // Team Check
  346. if (ValiantAimHacks.TeamCheck and not ValiantAimHacks.checkTeam(Player, LocalPlayer)) then continue end
  347.  
  348. -- // Check if is in FOV
  349. if (circle.Radius > Magnitude and Magnitude < ShortestDistance) then
  350. -- // Check if Visible
  351. if (ValiantAimHacks.VisibleCheck and not ValiantAimHacks.isPartVisible(TargetPartTemp, Character)) then continue end
  352.  
  353. -- //
  354. ClosestPlayer = Player
  355. ShortestDistance = Magnitude
  356. TargetPart = TargetPartTemp
  357. end
  358. end
  359. end
  360. end
  361.  
  362. -- // End
  363. ValiantAimHacks.Selected = ClosestPlayer
  364. ValiantAimHacks.SelectedPart = TargetPart
  365. end
  366.  
  367. -- // Heartbeat Function
  368. Heartbeat:Connect(function()
  369. ValiantAimHacks.updateCircle()
  370. ValiantAimHacks.getClosestPlayerToCursor()
  371. end)
  372.  
  373. return ValiantAimHacks
  374.  
  375. --[[
  376. Examples:
  377.  
  378. --// Namecall Version // --
  379. -- // Metatable Variables
  380. local mt = getrawmetatable(game)
  381. local backupindex = mt.__index
  382. setreadonly(mt, false)
  383.  
  384. -- // Load Silent Aim
  385. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://pastebin.com/BhPYjE1Q"))()
  386.  
  387. -- // Hook
  388. mt.__namecall = newcclosure(function(...)
  389. -- // Vars
  390. local args = {...}
  391. local method = getnamecallmethod()
  392.  
  393. -- // Checks
  394. if (method == "FireServer") then
  395. if (args[1].Name == "RemoteNameHere") then
  396. -- change args
  397.  
  398. -- // Return changed arguments
  399. return backupnamecall(unpack(args))
  400. end
  401. end
  402.  
  403. -- // Return
  404. return backupnamecall(...)
  405. end)
  406.  
  407. -- // Revert Metatable readonly status
  408. setreadonly(mt, true)
  409.  
  410. -- // Index Version // --
  411. -- // Metatable Variables
  412. local mt = getrawmetatable(game)
  413. local backupindex = mt.__index
  414. setreadonly(mt, false)
  415.  
  416. -- // Load Silent Aim
  417. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://pastebin.com/BhPYjE1Q"))()
  418.  
  419. -- // Hook
  420. mt.__index = newcclosure(function(t, k)
  421. -- // Check if it trying to get our mouse's hit or target
  422. if (t:IsA("Mouse") and (k == "Hit" or k == "Target")) then
  423. -- // If we can use the silent aim
  424. if (ValiantAimHacks.checkSilentAim()) then
  425. -- // Vars
  426. local TargetPart = ValiantAimHacks.SelectedPart
  427.  
  428. -- // Return modded val
  429. return (k == "Hit" and TargetPart.CFrame or TargetPart)
  430. end
  431. end
  432.  
  433. -- // Return
  434. return backupindex(t, k)
  435. end)
  436.  
  437. -- // Revert Metatable readonly status
  438. setreadonly(mt, true)
  439. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement