Advertisement
Guest User

Bedwars Bow Aimbot

a guest
Jul 12th, 2021
3,753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.26 KB | None | 0 0
  1. --// Credits \\--
  2. --[[ egg salad - __namecall hook ]]--
  3. --[[ Ezpi#0474 - Creator of this script ]]--
  4. --[[ CW Crew - Emotional support ]]--
  5.  
  6. --// Settings \\--
  7. FOV = 250
  8.  
  9. --// Service \\--
  10. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  11. local Players = game:GetService("Players")
  12. local Workspace = game:GetService("Workspace")
  13.  
  14. --// Variables \\--
  15. local Camera = Workspace.CurrentCamera
  16. local Player = Players.LocalPlayer
  17. local Mouse = Player:GetMouse()
  18. local Net = ReplicatedStorage:WaitForChild("rbxts_include"):WaitForChild("node_modules"):WaitForChild("net"):WaitForChild("out"):WaitForChild("_NetManaged")
  19.  
  20. --// Prevent Normal Shooting \\--
  21. local old;
  22. old = hookfunction(getrawmetatable(game).__namecall,function(...)
  23.     local args = {...}
  24.     if getnamecallmethod() == "InvokeServer" and not checkcaller() and (args[1].Name == "ProjectileHit" or args[1].Name == "ProjectileFire") and tostring(args[2]) ~= "telepearl" then
  25.         return
  26.     end
  27.     return old(...)
  28. end)
  29.  
  30. --// Get Closest Enemy \\--
  31. function GetClosestPlayer()
  32.     local Closest = false
  33.     local Distance = FOV
  34.     local MousePos = Vector2.new(Mouse.X, Mouse.Y)
  35.     for _, A_1 in next, Players:GetPlayers() do
  36.         if A_1.Team ~= Player.Team and A_1.Character and A_1.Character.PrimaryPart and A_1.Character:FindFirstChild("Humanoid") and A_1.Character.Humanoid.Health > 0 then
  37.             local vector, onScreen = Camera:WorldToScreenPoint(A_1.Character.PrimaryPart.Position)
  38.             if onScreen then
  39.                 local NewDistance = (MousePos - Vector2.new(vector.X, vector.Y)).Magnitude
  40.                 if NewDistance < Distance then
  41.                     Distance = NewDistance
  42.                     Closest = A_1.Character.PrimaryPart
  43.                 end
  44.             end
  45.         end
  46.     end
  47.     warn(Distance)
  48.     return Closest
  49. end
  50.  
  51. --// Mouse Connector \\--
  52. local Debounce = false
  53. Mouse.Button1Down:Connect(function()
  54.     --// Debounce Check \\--
  55.     if Debounce then
  56.         return
  57.     else
  58.         Debounce = true
  59.     end
  60.  
  61.     --// Get Closest Enemy \\--
  62.     local Target = GetClosestPlayer()
  63.     if not Target then
  64.         Debounce = false
  65.         return
  66.     end
  67.  
  68.     --// Get Correct Inventory \\--
  69.     local Inventory = false
  70.     for _, A_1 in next, ReplicatedStorage:WaitForChild("Inventories"):GetChildren() do
  71.         if A_1.Name == Player.Name and (A_1:FindFirstChild("wood_bow") or A_1:FindFirstChild("wood_crossbow")) then
  72.             Inventory = A_1
  73.             break
  74.         end
  75.     end
  76.     if not Inventory then
  77.         Debounce = false
  78.         return
  79.     end
  80.  
  81.     --// Type \\--
  82.     local Bow = Inventory:FindFirstChild("wood_bow") or Inventory:FindFirstChild("wood_crossbow")
  83.  
  84.     --// Shoot Attempt \\--
  85.     local Arrow = Net:WaitForChild("ProjectileFire"):InvokeServer(Bow)
  86.  
  87.     --// Hit Attempt \\--
  88.     if typeof(Arrow) == "Instance" then
  89.         local Content = {
  90.             part = Target,
  91.             velocity = Vector3.new(),
  92.             hitCFrame = Target.CFrame + Vector3.new(0, 1, 0),
  93.             percentPullStrength = 1
  94.         }
  95.         Net:WaitForChild("ProjectileHit"):InvokeServer(Bow.Name == "wood_bow" and "arrow" or "crossbow_arrow", Arrow, Content)
  96.     end
  97.  
  98.     -- Debounce
  99.     Debounce = false
  100. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement