Advertisement
Guest User

Valley prison silent aim criminals

a guest
Oct 30th, 2024
1,204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.23 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 = 60,
  44. HitChance = 100,
  45. Selected = LocalPlayer,
  46. SelectedPart = nil,
  47. TargetPart = {"Head", "HumanoidRootPart"},
  48. BlacklistedTeams = {
  49. game:GetService("Teams"):FindFirstChild("Maximum Security"),
  50. game:GetService("Teams"):FindFirstChild("Minimum Security"),
  51. game:GetService("Teams"):FindFirstChild("Medium Security"),
  52. game:GetService("Teams"):FindFirstChild("Escapee"),
  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. -- // Check teams
  113. function ValiantAimHacks.checkTeam(targetPlayer)
  114. -- Check if the target player is in any blacklisted teams
  115. for _, blacklistedTeam in ipairs(ValiantAimHacks.BlacklistedTeams) do
  116. if blacklistedTeam and targetPlayer.Team == blacklistedTeam then
  117. return false -- Ignore this target as they're in a blacklisted team
  118. end
  119. end
  120. return true -- Target is not in a blacklisted team
  121. end
  122.  
  123. -- // Check if player is blacklisted
  124. function ValiantAimHacks.checkPlayer(targetPlayer)
  125. for i = 1, #ValiantAimHacks.BlacklistedPlayers do
  126. local v = ValiantAimHacks.BlacklistedPlayers[i]
  127.  
  128. if (v ~= targetPlayer) then
  129. return true
  130. end
  131. end
  132.  
  133. -- // Return
  134. return false
  135. end
  136.  
  137. -- // Check if player is whitelisted
  138. function ValiantAimHacks.checkWhitelisted(targetPlayer)
  139. for i = 1, #ValiantAimHacks.WhitelistedPUIDs do
  140. local v = ValiantAimHacks.WhitelistedPUIDs[i]
  141.  
  142. if (targetPlayer.UserId == v) then
  143. return true
  144. end
  145. end
  146.  
  147. -- // Return
  148. return false
  149. end
  150.  
  151. -- // Blacklist player
  152. function ValiantAimHacks.BlacklistPlayer(Player)
  153. local BlacklistedPlayers = ValiantAimHacks.BlacklistedPlayers
  154.  
  155. -- // Find player in table
  156. for i = 1, #BlacklistedPlayers do
  157. local BlacklistedPlayer = BlacklistedPlayers[i]
  158.  
  159. if (BlacklistedPlayer == Player) then
  160. return false
  161. end
  162. end
  163.  
  164. -- // Blacklist player
  165. BlacklistedPlayers[#BlacklistedPlayers + 1] = Player
  166. return true
  167. end
  168.  
  169. -- // Unblacklist Player
  170. function ValiantAimHacks.UnblacklistPlayer(Player)
  171. local BlacklistedPlayers = ValiantAimHacks.BlacklistedPlayers
  172.  
  173. -- // Find player in table
  174. for i = 1, #BlacklistedPlayers do
  175. local BlacklistedPlayer = BlacklistedPlayers[i]
  176.  
  177. if (BlacklistedPlayer == Player) then
  178. table.remove(BlacklistedPlayer, i)
  179. return true
  180. end
  181. end
  182.  
  183. -- //
  184. return false
  185. end
  186.  
  187. -- // Whitelist player
  188. function ValiantAimHacks.WhitelistPlayer(PlayerId)
  189. local WhitelistedPUIDs = ValiantAimHacks.WhitelistedPUIDs
  190.  
  191. -- // Find player in table
  192. for i = 1, #WhitelistedPUIDs do
  193. local WhitelistedPUID = WhitelistedPUIDs[i]
  194.  
  195. if (WhitelistedPUID == PlayerId) then
  196. return false
  197. end
  198. end
  199.  
  200. -- // Whitelist player
  201. WhitelistedPUIDs[#WhitelistedPUIDs + 1] = PlayerId
  202. return true
  203. end
  204.  
  205. -- // Unwhitelist Player
  206. function ValiantAimHacks.UnwhitelistPlayer(PlayerId)
  207. local WhitelistedPUIDs = ValiantAimHacks.WhitelistedPUIDs
  208.  
  209. -- // Find player in table
  210. for i = 1, #WhitelistedPUIDs do
  211. local WhitelistedPUID = WhitelistedPUIDs[i]
  212.  
  213. if (WhitelistedPUID == PlayerId) then
  214. table.remove(WhitelistedPUID, i)
  215. return true
  216. end
  217. end
  218.  
  219. -- //
  220. return false
  221. end
  222.  
  223. -- // Get the Direction, Normal and Material
  224. function ValiantAimHacks.findDirectionNormalMaterial(Origin, Destination, UnitMultiplier)
  225. if (typeof(Origin) == "Vector3" and typeof(Destination) == "Vector3") then
  226. -- // Handling
  227. if (not UnitMultiplier) then UnitMultiplier = 1 end
  228.  
  229. -- // Vars
  230. local Direction = (Destination - Origin).Unit * UnitMultiplier
  231. local RaycastResult = Raycast(Workspace, Origin, Direction)
  232.  
  233. if (RaycastResult ~= nil) then
  234. local Normal = RaycastResult.Normal
  235. local Material = RaycastResult.Material
  236.  
  237. return Direction, Normal, Material
  238. end
  239. end
  240.  
  241. -- // Return
  242. return nil
  243. end
  244.  
  245. -- // Get Character
  246. function ValiantAimHacks.getCharacter(Player)
  247. return Player.Character
  248. end
  249.  
  250. -- // Check Health
  251. function ValiantAimHacks.checkHealth(Player)
  252. local Character = ValiantAimHacks.getCharacter(Player)
  253. local Humanoid = FindFirstChildWhichIsA(Character, "Humanoid")
  254.  
  255. local Health = (Humanoid and Humanoid.Health or 0)
  256. return Health > 0
  257. end
  258.  
  259. -- // Check if silent aim can used
  260. function ValiantAimHacks.checkSilentAim()
  261. return (ValiantAimHacks.SilentAimEnabled == true and ValiantAimHacks.Selected ~= LocalPlayer and ValiantAimHacks.SelectedPart ~= nil)
  262. end
  263.  
  264. -- // Get Closest Target Part
  265. function ValiantAimHacks.getClosestTargetPartToCursor(Character)
  266. local TargetParts = ValiantAimHacks.TargetPart
  267.  
  268. -- // Vars
  269. local ClosestPart = nil
  270. local ClosestPartPosition = nil
  271. local ClosestPartOnScreen = false
  272. local ClosestPartMagnitudeFromMouse = nil
  273. local ShortestDistance = 1/0
  274.  
  275. -- //
  276. local function checkTargetPart(TargetPartName)
  277. local TargetPart = FindFirstChild(Character, TargetPartName)
  278.  
  279. if (TargetPart) then
  280. local PartPos, onScreen = WorldToViewportPoint(CurrentCamera, TargetPart.Position)
  281. local Magnitude = (Vector2new(PartPos.X, PartPos.Y) - Vector2new(Mouse.X, Mouse.Y)).Magnitude
  282.  
  283. if (Magnitude < ShortestDistance) then
  284. ClosestPart = TargetPart
  285. ClosestPartPosition = PartPos
  286. ClosestPartOnScreen = onScreen
  287. ClosestPartMagnitudeFromMouse = Magnitude
  288. ShortestDistance = Magnitude
  289. end
  290. end
  291. end
  292.  
  293. -- // String check
  294. if (typeof(TargetParts) == "string") then
  295. checkTargetPart(TargetParts)
  296. end
  297.  
  298. -- // Loop through all target parts
  299. if (typeof(TargetParts) == "table") then
  300. for i = 1, #TargetParts do
  301. local TargetPartName = TargetParts[i]
  302. checkTargetPart(TargetPartName)
  303. end
  304. end
  305.  
  306. -- //
  307. return ClosestPart, ClosestPartPosition, ClosestPartOnScreen, ClosestPartMagnitudeFromMouse
  308. end
  309.  
  310. -- // Silent Aim Function
  311. function ValiantAimHacks.getClosestPlayerToCursor()
  312. -- // Vars
  313. local TargetPart = nil
  314. local ClosestPlayer = nil
  315. local Chance = calcChance(ValiantAimHacks.HitChance)
  316. local ShortestDistance = 1/0
  317.  
  318. -- // Chance
  319. if (not Chance) then
  320. ValiantAimHacks.Selected = LocalPlayer
  321. ValiantAimHacks.SelectedPart = nil
  322.  
  323. return LocalPlayer
  324. end
  325.  
  326. -- // Loop through all players
  327. local AllPlayers = GetPlayers(Players)
  328. for i = 1, #AllPlayers do
  329. local Player = AllPlayers[i]
  330. local Character = ValiantAimHacks.getCharacter(Player)
  331.  
  332. if (not ValiantAimHacks.checkWhitelisted(Player) and ValiantAimHacks.checkPlayer(Player) and Character) then
  333. local TargetPartTemp, PartPos, onScreen, Magnitude = ValiantAimHacks.getClosestTargetPartToCursor(Character)
  334.  
  335. if (TargetPartTemp and ValiantAimHacks.checkHealth(Player)) then
  336. -- // Team Check
  337. if (ValiantAimHacks.TeamCheck and not ValiantAimHacks.checkTeam(Player, LocalPlayer)) then continue end
  338.  
  339. -- // Check if is in FOV
  340. if (circle.Radius > Magnitude and Magnitude < ShortestDistance) then
  341. -- // Check if Visible
  342. if (ValiantAimHacks.VisibleCheck and not ValiantAimHacks.isPartVisible(TargetPartTemp, Character)) then continue end
  343.  
  344. -- //
  345. ClosestPlayer = Player
  346. ShortestDistance = Magnitude
  347. TargetPart = TargetPartTemp
  348. end
  349. end
  350. end
  351. end
  352.  
  353. -- // End
  354. ValiantAimHacks.Selected = ClosestPlayer
  355. ValiantAimHacks.SelectedPart = TargetPart
  356. end
  357.  
  358. -- // Heartbeat Function
  359. Heartbeat:Connect(function()
  360. ValiantAimHacks.updateCircle()
  361. ValiantAimHacks.getClosestPlayerToCursor()
  362. end)
  363.  
  364. return ValiantAimHacks
  365.  
  366. --[[
  367. Examples:
  368.  
  369. --// Namecall Version // --
  370. -- // Metatable Variables
  371. local mt = getrawmetatable(game)
  372. local backupindex = mt.__index
  373. setreadonly(mt, false)
  374.  
  375. -- // Load Silent Aim
  376. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/Stefanuk12/ROBLOX/master/Universal/Experimental%20Silent%20Aim%20Module.lua"))()
  377.  
  378. -- // Hook
  379. mt.__namecall = newcclosure(function(...)
  380. -- // Vars
  381. local args = {...}
  382. local method = getnamecallmethod()
  383.  
  384. -- // Checks
  385. if (method == "FireServer") then
  386. if (args[1].Name == "RemoteNameHere") then
  387. -- change args
  388.  
  389. -- // Return changed arguments
  390. return backupnamecall(unpack(args))
  391. end
  392. end
  393.  
  394. -- // Return
  395. return backupnamecall(...)
  396. end)
  397.  
  398. -- // Revert Metatable readonly status
  399. setreadonly(mt, true)
  400.  
  401. -- // Index Version // --
  402. -- // Metatable Variables
  403. local mt = getrawmetatable(game)
  404. local backupindex = mt.__index
  405. setreadonly(mt, false)
  406.  
  407. -- // Load Silent Aim
  408. local ValiantAimHacks = loadstring(game:HttpGetAsync("https://raw.githubusercontent.com/Stefanuk12/ROBLOX/master/Universal/Experimental%20Silent%20Aim%20Module.lua"))()
  409.  
  410. -- // Hook
  411. mt.__index = newcclosure(function(t, k)
  412. -- // Check if it trying to get our mouse's hit or target
  413. if (t:IsA("Mouse") and (k == "Hit" or k == "Target")) then
  414. -- // If we can use the silent aim
  415. if (ValiantAimHacks.checkSilentAim()) then
  416. -- // Vars
  417. local TargetPart = ValiantAimHacks.SelectedPart
  418.  
  419. -- // Return modded val
  420. return (k == "Hit" and TargetPart.CFrame or TargetPart)
  421. end
  422. end
  423.  
  424. -- // Return
  425. return backupindex(t, k)
  426. end)
  427.  
  428. -- // Revert Metatable readonly status
  429. setreadonly(mt, true)
  430. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement