Advertisement
HiDOHF

Roblox No-Scope Arcade

Feb 26th, 2024 (edited)
5,474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.46 KB | None | 0 0
  1. --by Nothingnesser
  2.  
  3. local S = {
  4.     F = 45, --AIM:HumanoidRootPart FOV
  5.     P = 20, --AIM:HEAD FOV
  6.     C = true
  7. }
  8.  
  9. local Players = game:GetService("Players")
  10. local RunService = game:GetService("RunService")
  11.  
  12. local LocalPlayer = Players.LocalPlayer
  13. local Workspace = game.Workspace
  14. local CurrentCamera = Workspace.CurrentCamera
  15. local Mouse = LocalPlayer:GetMouse()
  16.  
  17. local function GetPlayersInFOV(maxDistance, partName)
  18.     local playersInFOV = {}
  19.    
  20.     for _, player in pairs(Players:GetPlayers()) do
  21.         if player ~= LocalPlayer and player.Character and player.Character:FindFirstChild(partName) then
  22.             local part = player.Character:FindFirstChild(partName)
  23.             if part then
  24.                 local position, onScreen = CurrentCamera:WorldToViewportPoint(part.Position)
  25.                 local distance = (Vector2.new(position.X, position.Y) - Vector2.new(CurrentCamera.ViewportSize.X / 2, CurrentCamera.ViewportSize.Y / 2)).Magnitude
  26.                
  27.                 if distance <= maxDistance and onScreen then
  28.                     table.insert(playersInFOV, player)
  29.                 end
  30.             end
  31.         end
  32.     end
  33.    
  34.     return playersInFOV
  35. end
  36.  
  37. local playersInFOV = {}
  38. local playersInSmallFOV = {}
  39. local fovCircle = Drawing.new("Circle")
  40. local smallFovCircle = Drawing.new("Circle")
  41. local outerCircle = Drawing.new("Circle")
  42. local lines = {}
  43.  
  44. fovCircle.Visible = true
  45. fovCircle.Color = Color3.fromHSV(tick() % 5/ 5, 1, 1)
  46. fovCircle.Filled = false
  47.  
  48. smallFovCircle.Visible = true
  49. smallFovCircle.Color = Color3.new(1, 1, 1)
  50. smallFovCircle.Filled = false
  51.  
  52. outerCircle.Visible = false
  53.  
  54. local function UpdateLines()
  55.     for _, line in pairs(lines) do
  56.         line:Remove()
  57.     end
  58.     lines = {}
  59.    
  60.     local playerCount = #playersInFOV
  61.     if playerCount > 0 then
  62.         for i, player in ipairs(playersInFOV) do
  63.             local line = Drawing.new("Line")
  64.             line.Visible = true
  65.             if i == 1 then
  66.                 line.Color = Color3.new(1, 0, 0)
  67.             else
  68.                 line.Color = Color3.new(1, 1, 1)
  69.             end
  70.             table.insert(lines, line)
  71.         end
  72.     end
  73. end
  74.  
  75. RunService.RenderStepped:Connect(function()
  76.     fovCircle.Radius = S.F
  77.     fovCircle.Position = Vector2.new(CurrentCamera.ViewportSize.X / 2, CurrentCamera.ViewportSize.Y / 2)
  78.    
  79.     smallFovCircle.Radius = S.P
  80.     smallFovCircle.Position = Vector2.new(CurrentCamera.ViewportSize.X / 2, CurrentCamera.ViewportSize.Y / 2)
  81.    
  82.     outerCircle.Position = fovCircle.Position
  83.     outerCircle.Radius = fovCircle.Radius + 20
  84.     outerCircle.Thickness = 0.4
  85.  
  86.     playersInFOV = GetPlayersInFOV(S.F, "HumanoidRootPart")
  87.     playersInSmallFOV = GetPlayersInFOV(S.P, "Head")
  88.    
  89.     UpdateLines()
  90.    
  91.     fovCircle.Color = Color3.fromHSV(tick() % 5/ 5, 1, 1)
  92.    
  93.     for i, player in ipairs(playersInFOV) do
  94.         local line = lines[i]
  95.         if player and player.Character then
  96.             local head = player.Character["Head"]
  97.             if head then
  98.                 local targetPos, onScreen = CurrentCamera:WorldToViewportPoint(head.Position)
  99.                 if onScreen then
  100.                     line.From = Vector2.new(CurrentCamera.ViewportSize.X / 2, CurrentCamera.ViewportSize.Y / 2)
  101.                     line.To = Vector2.new(targetPos.X, targetPos.Y)
  102.                     line.Visible = true
  103.                 else
  104.                     line.Visible = false
  105.                 end
  106.             else
  107.                 line.Visible = false
  108.             end
  109.         else
  110.             line.Visible = false
  111.         end
  112.     end
  113.    
  114.     for _, player in ipairs(playersInSmallFOV) do
  115.         if player and player.Character then
  116.             local head = player.Character["Head"]
  117.             if head then
  118.                 local targetPos, onScreen = CurrentCamera:WorldToViewportPoint(head.Position)
  119.                 if onScreen then
  120.                     Mouse.Target = head
  121.                 end
  122.             end
  123.         end
  124.     end
  125. end)
  126.  
  127. local originalMetatable; originalMetatable = hookmetamethod(game, "__namecall", function(Self, ...)
  128.     local Args = {...}
  129.     local Method = getnamecallmethod()
  130.    
  131.     if not checkcaller() and Method == "FireServer" then
  132.         if Self.Name == "0+." then
  133.             Args[1].MessageWarning = {}
  134.             Args[1].MessageError = {}
  135.             Args[1].MessageOutput = {}
  136.             Args[1].MessageInfo = {}
  137.         elseif Self.Name == "RemoteEvent" and Args[2] == "Bullet" and Method == "FireServer" then
  138.             local closestPlayer
  139.             if #playersInSmallFOV > 0 then
  140.                 closestPlayer = playersInSmallFOV[1]
  141.             elseif #playersInFOV > 0 then
  142.                 closestPlayer = playersInFOV[1]
  143.             end
  144.            
  145.             if closestPlayer and closestPlayer.Character and closestPlayer.Character.Humanoid and closestPlayer.Character.Humanoid.Health ~= 0 then
  146.                 local part
  147.                 if #playersInSmallFOV > 0 then
  148.                     part = closestPlayer.Character["Head"]
  149.                 elseif #playersInFOV > 0 then
  150.                     part = closestPlayer.Character["HumanoidRootPart"]
  151.                 end
  152.                
  153.                 if part then
  154.                     Args[3] = closestPlayer.Character
  155.                     Args[4] = part
  156.                     Args[5] = part.Position
  157.                 end
  158.             end
  159.         end
  160.     end
  161.    
  162.     return originalMetatable(Self, unpack(Args))
  163. end)
  164.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement