1local cloneref = cloneref or function(...)2 return ...3end45local GetService = setmetatable({}, {6 __index = function(self, key)7 return cloneref(game:GetService(key))8 end9})1011getgenv().Services = {12 RunService = GetService.RunService,13 Players = GetService.Players,14 UserInputService = GetService.UserInputService,15 CoreGui = GetService.CoreGui,16 TweenService = GetService.TweenService,17 ReplicatedStorage = GetService.ReplicatedStorage,18 HttpService = GetService.HttpService,19 Lighting = GetService.Lighting,20 WorkSpace = GetService.Workspace,21 Debris = GetService.Debris,22}2324Services.CurrentCamera = Services.WorkSpace.CurrentCamera25Services.LocalPlayer = Services.Players.LocalPlayer2627local HitParl = Services.ReplicatedStorage:WaitForChild("Events"):WaitForChild("HitParl")28local Weapons = Services.ReplicatedStorage:WaitForChild("Weapons")29local PlayerGui = Services.LocalPlayer:WaitForChild("PlayerGui")3031local firebullet3233local function findFireBullet()34 for _, fn in ipairs(getgc(false)) do35 if type(fn) == "function" and islclosure(fn) then36 local ok, consts = pcall(debug.getconstants, fn)37 if ok and consts then38 local hit, rep, range, melee = false, false, false, false39 for i = 1, #consts do40 local c = consts[i]41 if c == "HitParl" then42 hit = true43 elseif c == "ReplicateShot" then44 rep = true45 elseif c == "Range" then46 range = true47 elseif c == "Melee" then48 melee = true49 end50 end51 if hit and rep and range and melee then52 return fn53 end54 end55 end56 end57end5859firebullet = findFireBullet()6061local function encodeHitPos(pos)62 return Vector3.new(63 ((pos.X - 156325) * 13 + 17854) * 16,64 (pos.Y + 64000) * 7 - 142657,65 (pos.Z * 9 - 47000) * 666 )67end6869local function isEnemy(player)70 if player == Services.LocalPlayer then71 return false72 end73 local myStatus = Services.LocalPlayer:FindFirstChild("Status")74 local theirStatus = player:FindFirstChild("Status")75 if myStatus and theirStatus and myStatus:FindFirstChild("Team") and theirStatus:FindFirstChild("Team") then76 return myStatus.Team.Value ~= theirStatus.Team.Value77 end78 return true79end8081local function Closest()82 local camera = Services.WorkSpace.CurrentCamera or Services.CurrentCamera83 if not camera then84 return85 end86 local origin = camera.CFrame.Position87 local closest, closestDistance88 closestDistance = math.huge89 for _, player in ipairs(Services.Players:GetPlayers()) do90 if isEnemy(player) and player.Character then91 local character = player.Character92 local humanoid = character:FindFirstChildOfClass("Humanoid") or character:FindFirstChild("Humanoid2")93 local head = character:FindFirstChild("HeadHB")94 or character:FindFirstChild("FakeHead")95 or character:FindFirstChild("Head")96 if humanoid and humanoid.Health > 0 and head then97 local distance = (head.Position - origin).Magnitude98 if distance < closestDistance then99 closestDistance = distance100 closest = head101 end102 end103 end104 end105 return closest106end107108local function getRange()109 local banana = Weapons:FindFirstChild("Banana")110 if banana and banana:FindFirstChild("Melee") then111 return 48112 end113 if banana and banana:FindFirstChild("Range") then114 return banana.Range.Value115 end116 return 48117end118119local function fireHitParl(head)120 local character = Services.LocalPlayer.Character121 local gunModel = character and character:FindFirstChild("Gun")122 if not head or not gunModel then123 return124 end125126 local rangeValue = getRange()127 local camera = Services.WorkSpace.CurrentCamera or Services.CurrentCamera128 local cameraPosition = camera and camera.CFrame.Position or head.Position129 local normal = head.Position - cameraPosition130 if normal.Magnitude > 0 then131 normal = normal.Unit132 else133 normal = Vector3.new(0, 1, 0)134 end135136 HitParl:FireServer(137 head,138 encodeHitPos(head.Position),139 "Banana",140 rangeValue,141 gunModel,142 nil,143 1,144 rangeValue == 48,145 true,146 cameraPosition,147 Services.WorkSpace:GetServerTimeNow(),148 normal,149 true,150 true,151 true,152 true,153 true,154 nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil155 )156end157158task.spawn(function()159 while true do160 task.wait(0.08)161 local head = Closest()162 if head then163 if not firebullet then164 firebullet = findFireBullet()165 end166 if firebullet then167 pcall(firebullet)168 end169 pcall(fireHitParl, head)170 end171 end172end)
Comments
Loading comments…