gtnocayt

GUNFIGHT ARENA HEHEHE

Dec 23rd, 2024 (edited)
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.12 KB | Gaming | 0 0
  1. --[[
  2.     WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
  3. ]]
  4. --[[ https://discord.gg/fWBngW2r5H ]]
  5.  
  6. --optimization and variables
  7. local game = game
  8. local players = game:GetService("Players")
  9. local player = players.LocalPlayer
  10. local UIS = game:GetService("UserInputService")
  11. local rs = game:GetService("RunService")
  12. local cg = cloneref(game:GetService("CoreGui"))
  13. local camera = workspace.CurrentCamera
  14. local instance = Instance.new
  15. local udim2 = UDim2.new
  16. local vector2 = Vector2.new
  17. local vector3 = Vector3.new
  18. local color3 = Color3.new
  19. local cframe = CFrame.new
  20. local enum = Enum.KeyCode
  21. local silentaim = false
  22. local silentkeybindtoggle = false
  23. local silentkeybind = false
  24. local noforcefields = false
  25. local weapons = {}
  26. for _,v in pairs(game:GetService("ReplicatedStorage").Weapons:GetChildren()) do
  27.     table.insert(weapons,v.Name)
  28. end
  29. local camos = {}
  30. for _,v in pairs(game:GetService("ReplicatedStorage").Camos:GetChildren()) do
  31.     table.insert(camos,v.Name)
  32. end
  33. local primary
  34. local secondary
  35. local primarycamo
  36. local secondarycamo
  37. ---
  38.  
  39. --- functions
  40. local s=player.PlayerScripts.Vortex.Modifiers.Steadiness
  41. local m=player.PlayerScripts.Vortex.Modifiers.Mobility
  42. local function r()
  43. if s and s.Value>0 then s.Value=0 end
  44. if m and m.Value>0 then m.Value=0 end
  45. end
  46. if s then s.Changed:Connect(r) end
  47. if m then m.Changed:Connect(r) end
  48. r()
  49.  
  50. local function visible(origin, direction, target, ignore)
  51.     local params = RaycastParams.new()
  52.  
  53.     local filterList = {game.Players.LocalPlayer.Character, target}
  54.     if ignore then
  55.         for _, v in ipairs(ignore) do
  56.             table.insert(filterList, v)
  57.         end
  58.     end
  59.  
  60.     params.FilterDescendantsInstances = filterList
  61.     return (not workspace:Raycast(origin, direction, params))
  62. end
  63.  
  64. local closestPlayer = nil
  65. local team = nil
  66.  
  67. local function getClosestPlayer()
  68.     team = player:GetAttribute("Team")
  69.     local closest, distance = nil, math.huge
  70.  
  71.     for _, character in ipairs(workspace:GetChildren()) do
  72.         local humanoid = character:FindFirstChild("Humanoid")
  73.         if character and humanoid and humanoid.Health > 0 then
  74.             local player = players:FindFirstChild(character.Name)
  75.             if player and player:GetAttribute("Team") ~= team then
  76.                 local head = character:FindFirstChild("Head")
  77.                 if head then
  78.                     local w2s, onscreen = camera:WorldToViewportPoint(head.Position)
  79.                     if onscreen then
  80.                         local dist = (vector2(w2s.X, w2s.Y) - vector2(camera.ViewportSize.X / 2, camera.ViewportSize.Y / 2)).Magnitude
  81.                         if dist < distance then
  82.                             -- Check if the player is visible before targeting them
  83.                             local origin = camera.CFrame.Position
  84.                             local direction = head.Position - origin
  85.                             if visible(origin, direction, character, nil) then
  86.                                 closest = character
  87.                                 distance = dist
  88.                             end
  89.                         end
  90.                     end
  91.                 end
  92.             end
  93.         end
  94.     end
  95.     return closest
  96. end
  97.  
  98. rs.RenderStepped:Connect(function()
  99.     closestPlayer = getClosestPlayer()
  100. end)
  101.  
  102. local oldIndex
  103. oldIndex = hookmetamethod(game, "__index", function(self, index)
  104.     local func = debug.getinfo(3, "n")
  105.     if func and func.name then
  106.         if func.name == "Fire" and index == "CFrame" and closestPlayer then
  107.             local head = closestPlayer:FindFirstChild("Head")
  108.             if head then
  109.                 -- Check visibility
  110.                 local origin = camera.CFrame.Position
  111.                 local direction = head.Position - origin
  112.                 if visible(origin, direction, closestPlayer, nil) and silentaim then
  113.                     if silentkeybindtoggle then
  114.                         if silentkeybind then
  115.                             return cframe(head.Position)
  116.                         end
  117.                     else
  118.                         return cframe(head.Position)
  119.                     end
  120.                 end
  121.             end
  122.         end
  123.     end
  124.     return oldIndex(self, index)
  125. end)
  126.  
  127. rs.RenderStepped:Connect(function()
  128.     for _,v in pairs(game:GetService("Workspace").Env:GetChildren()) do
  129.         if string.find(v.Name, "Forcefield") and noforcefields then
  130.             if v.FullSphere.Color ~= Color3.fromRGB(0, 102, 255) then
  131.                 v:Destroy()
  132.             end
  133.         end
  134.     end
  135. end)
  136. ---
  137.  
  138. --- ui
  139. local OrionLib = loadstring(game:HttpGet(('https://raw.githubusercontent.com/shlexware/Orion/main/source')))()
  140.  
  141. OrionLib:MakeNotification({
  142.     Name = "GunFight Arena",
  143.     Content = "",
  144.     Image = "rbxassetid://4483345998",
  145.     Time = 5
  146. })
  147.  
  148. local Window = OrionLib:MakeWindow({Name = "Gunfight arena", HidePremium = false, SaveConfig = false, ConfigFolder = "gunfight arena"})
  149.  
  150.  
  151. local aimtab = Window:MakeTab({
  152.     Name = "Aim",
  153.     Icon = "rbxassetid://4483345998",
  154.     PremiumOnly = false
  155. })
  156. local weapontab = Window:MakeTab({
  157.     Name = "weapons",
  158.     Icon = "rbxassetid://4483345998",
  159.     PremiumOnly = false
  160. })
  161.  
  162. local aimsection = aimtab:AddSection({
  163.     Name = "SilentAim"
  164. })
  165.  
  166.  
  167. aimsection:AddToggle({
  168.     Name = "Silent Aim",
  169.     Default = false,
  170.     Callback = function(Value)
  171.         silentaim = Value
  172.     end    
  173. })
  174.  
  175. aimsection:AddToggle({
  176.     Name = "SilentAim keybind toggle",
  177.     Default = false,
  178.     Callback = function(Value)
  179.         silentkeybindtoggle = Value
  180.     end    
  181. })
  182.  
  183. aimsection:AddBind({
  184.     Name = "silent aim keybind",
  185.     Default = enum.E,
  186.     Hold = false,
  187.     Callback = function()
  188.         if silentkeybindtoggle then
  189.             if silentkeybind then
  190.                 silentkeybind = false
  191.             else
  192.                 silentkeybind = true
  193.             end
  194.         end
  195.     end    
  196. })
  197.  
  198. local miscsection = aimtab:AddSection({
  199.     Name = "Misc"
  200. })
  201.  
  202. miscsection:AddToggle({
  203.     Name = "no enemy forcefields",
  204.     Default = false,
  205.     Callback = function(Value)
  206.         noforcefields = Value
  207.     end    
  208. })
  209.  
  210. local primarySection = weapontab:AddSection({
  211.     Name = "primary weapon changer"
  212. })
  213.  
  214. local primaryDropdown = primarySection:AddDropdown({
  215.     Name = "gun selector",
  216.     Default = weapons[1],
  217.     Options = weapons,
  218.     Callback = function(Value)
  219.         primary = Value
  220.     end,
  221. })
  222.  
  223. local primarybutton = primarySection:AddButton({
  224.     Name = "equip gun",
  225.     Callback = function()
  226.         player:SetAttribute("Primary",primary)
  227.     end,
  228. })
  229.  
  230. local primarySection2 = weapontab:AddSection({
  231.     Name = "primary weapon camo changer"
  232. })
  233.  
  234. local primaryDropdown2 = primarySection2:AddDropdown({
  235.     Name = "camo selector",
  236.     Default = camos[1],
  237.     Options = camos,
  238.     Callback = function(Value)
  239.         primarycamo = Value
  240.     end,
  241. })
  242.  
  243. local primarybutton2 = primarySection2:AddButton({
  244.     Name = "equip camo",
  245.     Callback = function()
  246.         player:SetAttribute("PrimaryCamo",primarycamo)
  247.     end,
  248. })
  249.  
  250. local secondarySection = weapontab:AddSection({
  251.     Name = "Secondary weapon changer"
  252. })
  253.  
  254. local secondarydropdown = secondarySection:AddDropdown({
  255.     Name = "gun selector",
  256.     Default = weapons[1],
  257.     Options = weapons,
  258.     Callback = function(Value)
  259.         secondary = Value
  260.     end,
  261. })
  262.  
  263. local secondarybutton = secondarySection:AddButton({
  264.     Name = "equip gun",
  265.     Callback = function()
  266.         player:SetAttribute("Secondary",secondary)
  267.     end,
  268. })
  269.  
  270. local secondarySection2 = weapontab:AddSection({
  271.     Name = "Secondary weapon camo changer"
  272. })
  273.  
  274. local secondarydropdown2 = secondarySection2:AddDropdown({
  275.     Name = "camo selector",
  276.     Default = camos[1],
  277.     Options = camos,
  278.     Callback = function(Value)
  279.         secondarycamo = Value
  280.     end,
  281. })
  282.  
  283. local secondarybutton2 = secondarySection2:AddButton({
  284.     Name = "equip camo",
  285.     Callback = function()
  286.         player:SetAttribute("SecondaryCamo",secondarycamo)
  287.     end,
  288. })
  289.  
  290.  
  291.  
  292. local SettingsTab = Window:MakeTab({
  293.     Name = "Settings",
  294.     Icon = "rbxassetid://4483345998",
  295.     PremiumOnly = false
  296. })
  297.  
  298. local SettingsSection = SettingsTab:AddSection({
  299.     Name = "Settings"
  300. })
  301.  
  302. SettingsSection:AddButton({
  303.     Name = "Destroy UI",
  304.     Callback = function()
  305.         OrionLib:Destroy()
  306.     end    
  307. })
  308.  
  309.  
  310. OrionLib:Init()
  311. ---
Advertisement
Add Comment
Please, Sign In to add comment