Advertisement
zayzaaa2030

Untitled

Sep 26th, 2022
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.94 KB | None | 0 0
  1. if getgenv().ValiantAimHacks then return getgenv().ValiantAimHacks end
  2.  
  3. -- // Services
  4. local Players = game:GetService("Players")
  5. local Workspace = game:GetService("Workspace")
  6. local GuiService = game:GetService("GuiService")
  7. local RunService = game:GetService("RunService")
  8.  
  9. -- // Vars
  10. local Heartbeat = RunService.Heartbeat
  11. local LocalPlayer = Players.LocalPlayer
  12. local CurrentCamera = Workspace.CurrentCamera
  13. local Mouse = LocalPlayer:GetMouse()
  14.  
  15. -- // Silent Aim Vars
  16. getgenv().ValiantAimHacks = {
  17. SilentAimEnabled = true,
  18. ShowFOV = false,
  19. VisibleCheck = true,
  20. TeamCheck = false,
  21. FOV = 15,
  22. HitChance = 23,
  23. Selected = LocalPlayer,
  24. TargetPart = "UpperTorso",
  25. BlacklistedTeams = {
  26. {
  27. Team = LocalPlayer.Team,
  28. TeamColor = LocalPlayer.TeamColor,
  29. },
  30. },
  31. BlacklistedPlayers = {LocalPlayer},
  32. WhitelistedPUIDs = {91318356},
  33. }
  34.  
  35. -- // Show FOV
  36. local circle = Drawing.new("Circle")
  37. circle.Transparency = 0
  38. circle.Thickness = 2
  39. circle.Color = Color3.fromRGB(231, 84, 128)
  40. circle.NumSides = 12
  41. circle.Filled = false
  42. function ValiantAimHacks.updateCircle()
  43. if (circle) then
  44. -- // Set Circle Properties
  45. circle.Visible = ValiantAimHacks.ShowFOV
  46. circle.Radius = (ValiantAimHacks.FOV * 3)
  47. circle.Position = Vector2.new(Mouse.X, Mouse.Y + GuiService:GetGuiInset().Y)
  48.  
  49. -- // Return circle
  50. return circle
  51. end
  52. end
  53.  
  54. -- // Custom Functions
  55. calcChance = function(percentage)
  56. percentage = math.floor(percentage)
  57. local chance = math.floor(Random.new().NextNumber(Random.new(), 0, 1) * 25) / 25
  58. return chance <= percentage/25
  59. end
  60.  
  61. -- // Customisable Checking Functions: Is a part visible
  62. function ValiantAimHacks.isPartVisible(Part, PartDescendant)
  63. -- // Vars
  64. local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  65. local Origin = CurrentCamera.CFrame.Position
  66. local _, OnScreen = CurrentCamera:WorldToViewportPoint(Part.Position)
  67.  
  68. -- // If Part is on the screen
  69. if (OnScreen) then
  70. -- // Vars: Calculating if is visible
  71. local raycastParams = RaycastParams.new()
  72. raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
  73. raycastParams.FilterDescendantsInstances = {Character, CurrentCamera}
  74.  
  75. local Result = Workspace:Raycast(Origin, Part.Position - Origin, raycastParams)
  76. local PartHit = Result.Instance
  77. local Visible = (not PartHit or PartHit:IsDescendantOf(PartDescendant))
  78.  
  79. -- // Return
  80. return Visible
  81. end
  82.  
  83. -- // Return
  84. return false
  85. end
  86.  
  87. -- // Check teams
  88. function ValiantAimHacks.checkTeam(targetPlayerA, targetPlayerB)
  89. -- // If player is not on your team
  90. if (targetPlayerA.Team ~= targetPlayerB.Team) then
  91.  
  92. -- // Check if team is blacklisted
  93. for i = 1, #ValiantAimHacks.BlacklistedTeams do
  94. local v = ValiantAimHacks.BlacklistedTeams
  95.  
  96. if (targetPlayerA.Team ~= v.Team and targetPlayerA.TeamColor ~= v.TeamColor) then
  97. return true
  98. end
  99. end
  100. end
  101.  
  102. -- // Return
  103. return false
  104. end
  105.  
  106. -- // Check if player is blacklisted
  107. function ValiantAimHacks.checkPlayer(targetPlayer)
  108. for i = 1, #ValiantAimHacks.BlacklistedPlayers do
  109. local v = ValiantAimHacks.BlacklistedPlayers[i]
  110.  
  111. if (v ~= targetPlayer) then
  112. return true
  113. end
  114. end
  115.  
  116. -- // Return
  117. return false
  118. end
  119.  
  120. -- // Check if player is whitelisted
  121. function ValiantAimHacks.checkWhitelisted(targetPlayer)
  122. for i = 1, #ValiantAimHacks.WhitelistedPUIDs do
  123. local v = ValiantAimHacks.WhitelistedPUIDs[i]
  124.  
  125. if (targetPlayer.UserId == v) then
  126. return true
  127. end
  128. end
  129.  
  130. -- // Return
  131. return false
  132. end
  133.  
  134. -- // Get the Direction, Normal and Material
  135. function ValiantAimHacks.findDirectionNormalMaterial(Origin, Destination, UnitMultiplier)
  136. if (typeof(Origin) == "Vector3" and typeof(Destination) == "Vector3") then
  137. -- // Handling
  138. if (not UnitMultiplier) then UnitMultiplier = 1 end
  139.  
  140. -- // Vars
  141. local Direction = (Destination - Origin).Unit * UnitMultiplier
  142. local RaycastResult = Workspace:Raycast(Origin, Direction)
  143.  
  144. if (RaycastResult ~= nil) then
  145. local Normal = RaycastResult.Normal
  146. local Material = RaycastResult.Material
  147.  
  148. return Direction, Normal, Material
  149. end
  150. end
  151.  
  152. -- // Return
  153. return nil
  154. end
  155.  
  156. -- // Get Character
  157. function ValiantAimHacks.getCharacter(Player)
  158. return Player.Character
  159. end
  160.  
  161. -- // Check Health
  162. function ValiantAimHacks.checkHealth(Player)
  163. local Character = ValiantAimHacks.getCharacter(Player)
  164. local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
  165.  
  166. local Health = (Humanoid and Humanoid.Health or 0)
  167. return Health > 0
  168. end
  169.  
  170. -- // Check if silent aim can used
  171. function ValiantAimHacks.checkSilentAim()
  172. return (ValiantAimHacks.SilentAimEnabled == true and ValiantAimHacks.Selected ~= LocalPlayer)
  173. end
  174.  
  175. -- // Silent Aim Function
  176. function ValiantAimHacks.getClosestPlayerToCursor()
  177. -- // Vars
  178. local ClosestPlayer = nil
  179. local Chance = calcChance(ValiantAimHacks.HitChance)
  180. local ShortestDistance = 1/0
  181.  
  182. -- // Chance
  183. if (not Chance) then
  184. ValiantAimHacks.Selected = (Chance and LocalPlayer or LocalPlayer)
  185.  
  186. return (Chance and LocalPlayer or LocalPlayer)
  187. end
  188.  
  189. -- // Loop through all players
  190. local AllPlayers = Players:GetPlayers()
  191. for i = 1, #AllPlayers do
  192. local Player = AllPlayers[i]
  193. local Character = ValiantAimHacks.getCharacter(Player)
  194.  
  195. if (not ValiantAimHacks.checkWhitelisted(Player) and ValiantAimHacks.checkPlayer(Player) and Character and Character:FindFirstChild(ValiantAimHacks.TargetPart) and ValiantAimHacks.checkHealth(Player)) then
  196. -- // Team Check
  197. if (ValiantAimHacks.TeamCheck and not ValiantAimHacks.checkTeam(Player, LocalPlayer)) then continue end
  198.  
  199. -- // Vars
  200. local TargetPart = Character[ValiantAimHacks.TargetPart]
  201. local PartPos, _ = CurrentCamera:WorldToViewportPoint(TargetPart.Position)
  202. local Magnitude = (Vector2.new(PartPos.X, PartPos.Y) - Vector2.new(Mouse.X, Mouse.Y)).Magnitude
  203.  
  204. -- // Check if is in FOV
  205. if (circle.Radius > Magnitude and Magnitude < ShortestDistance) then
  206. -- // Check if Visible
  207. if (ValiantAimHacks.VisibleCheck and not ValiantAimHacks.isPartVisible(TargetPart, Character)) then continue end
  208.  
  209. -- //
  210. ClosestPlayer = Player
  211. ShortestDistance = Magnitude
  212. end
  213. end
  214. end
  215.  
  216. -- // End
  217. ValiantAimHacks.Selected = (Chance and ClosestPlayer or LocalPlayer)
  218. end
  219.  
  220. -- // Heartbeat Function
  221. Heartbeat:Connect(function()
  222. ValiantAimHacks.updateCircle()
  223. ValiantAimHacks.getClosestPlayerToCursor()
  224. end)
  225.  
  226. return ValiantAimHacks
  227.  
  228. --[[
  229. Examples:
  230.  
  231. --// Namecall Version // --
  232. -- // Metatable Variables
  233. local mt = getrawmetatable(game)
  234. local backupindex = mt.__index
  235. setreadonly(mt, false)
  236.  
  237. -- // Load Silent Aim
  238. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/Stefanuk12/ROBLOX/master/Universal/Experimental%20Silent%20Aim%20Module.lua"))()
  239.  
  240. -- // Hook
  241. mt.__namecall = newcclosure(function(...)
  242. -- // Vars
  243. local args = {...}
  244. local method = getnamecallmethod()
  245.  
  246. -- // Checks
  247. if (method == "FireServer") then
  248. if (args[1].Name == "RemoteNameHere") then
  249. -- change args
  250.  
  251. -- // Return changed arguments
  252. return backupnamecall(unpack(args))
  253. end
  254. end
  255.  
  256. -- // Return
  257. return backupnamecall(...)
  258. end)
  259.  
  260. -- // Revert Metatable readonly status
  261. setreadonly(mt, true)
  262.  
  263. -- // Index Version // --
  264. -- // Metatable Variables
  265. local mt = getrawmetatable(game)
  266. local backupindex = mt.__index
  267. setreadonly(mt, false)
  268.  
  269. -- // Load Silent Aim
  270. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/Stefanuk12/ROBLOX/master/Universal/Experimental%20Silent%20Aim%20Module.lua"))()
  271.  
  272. -- // Hook
  273. mt.__index = newcclosure(function(t, k)
  274. -- // Check if it trying to get our mouse's hit or target
  275. if (t:IsA("Mouse") and (k == "Hit" or k == "Target")) then
  276. -- // If we can use the silent aim
  277. if (ValiantAimHacks.checkSilentAim()) then
  278. -- // Vars
  279. local CPlayer = ValiantAimHacks.Selected
  280. local Character = ValiantAimHacks.getCharacter(CPlayer) -- // good practice to use this to get the character
  281.  
  282. -- // Return modded val
  283. return (k == "Hit" and Character.Head.CFrame or Character.Head)
  284. end
  285. end
  286.  
  287. -- // Return
  288. return backupindex(t, k)
  289. end)
  290.  
  291. -- // Revert Metatable readonly status
  292. setreadonly(mt, true)
  293. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement