Advertisement
Richbadniss

Bad Business-Silent Aim

Jun 23rd, 2022
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.04 KB | None | 0 0
  1. local UserInputService = game:GetService('UserInputService')
  2. local ReplicatedStorage= game:GetService('ReplicatedStorage')
  3. local Players = game:GetService('Players')
  4. local Player = Players.LocalPlayer
  5. local Camera = workspace.CurrentCamera
  6.  
  7. local Tortoise = require(game:GetService('ReplicatedStorage').TS)
  8. local Reticle = Tortoise.Input.Reticle
  9. local Character = Tortoise.Characters
  10. local Teams = Tortoise.Teams
  11. local Systemprojectiles = Tortoise.Projectiles
  12.  
  13. local WeaponData = { }
  14.  
  15. for Client, userConfig in next, ReplicatedStorage.Items.Base:GetChildren( ) do
  16.     local config = userConfig:FindFirstChild('Config', true)
  17.     if config then WeaponData[userConfig.Name] = require(config) end
  18. end
  19.  
  20. local bulletInfo = getupvalue(Systemprojectiles.InitProjectile, 1)
  21.  
  22. local function getBulletData()
  23.     local me = Character:GetCharacter(Player)
  24.     local backPack = me and me:FindFirstChild('Backpack')
  25.     if not backPack then return end
  26.  
  27.     local equipped = backPack:FindFirstChild('Equipped')
  28.     if not equipped then return end
  29.  
  30.     local projectile = WeaponData[tostring(equipped.Value)]
  31.     if not projectile or not projectile.Projectile then return end
  32.  
  33.     return bulletInfo[projectile.Projectile.Template]
  34. end
  35.  
  36. local function Attack(part)
  37.     local distance = (part.Position - Camera.CFrame.Position).magnitude
  38.     local bulletData = getBulletData(                                                                                                    )
  39.     if not bulletData then return end
  40.  
  41.     local timeToHit = distance / bulletData.Speed
  42.     local velocity = part.Velocity + Vector3.new(0, bulletData.Gravity * (timeToHit/2), 0)
  43.     local hitPosition = part.Position + (velocity * timeToHit)
  44.  
  45.     return hitPosition
  46. end
  47.  
  48. local function nearestTarget(bone : string)
  49.     local info = {
  50.         distance = math.huge,
  51.         player = nil,
  52.         character = nil,
  53.         bone = nil
  54.     }
  55.  
  56.     for _, player in next, Players:GetPlayers() do
  57.         if player == Player then continue end
  58.         local areFriendly = Teams:ArePlayersFriendly(player, Player)
  59.         local character = Character:GetCharacter(player)
  60.  
  61.         local body = (character and character:FindFirstChild('Body'))
  62.         local bone = (body) and (body:FindFirstChild(bone))
  63.         if areFriendly or not bone then continue end
  64.  
  65.         local screenPoint, onScreen = Camera:WorldToScreenPoint(bone.Position)
  66.         if not onScreen then continue end
  67.         local mousePosition = UserInputService:GetMouseLocation()
  68.         local distance = (Vector2.new(screenPoint.x, screenPoint.y) - mousePosition).magnitude
  69.         if distance > info.distance then continue end
  70.  
  71.         info = {
  72.             distance = distance,
  73.             player = player,
  74.             character = character,
  75.             bone = bone
  76.         }
  77.  
  78.     end
  79.  
  80.     return info
  81. end
  82.  
  83. local sightreticleLookVector = Reticle.LookVector
  84.  
  85. Reticle.LookVector = function(...)
  86.     local nearest = nearestTarget('Head')
  87.     if nearest.player then
  88.         local ArrowPridiction = Attack(nearest.bone)
  89.  
  90.         if ArrowPridiction then
  91.             return CFrame.new(Camera.CFrame.Position, ArrowPridiction).LookVector
  92.         end
  93.     end
  94.  
  95.     return sightreticleLookVector(...)
  96. end
  97.  
  98. setupvalue(Reticle.GetPosition, 1, Reticle.LookVector)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement