-- @build-failed -- killaura local getservice, findfirstchild, findfirstchildofclass, waitforchild = game.GetService, game.FindFirstChild, game.FindFirstChildOfClass, game.WaitForChild local players, replicatedstorage, runservice = getservice(game, "Players"), getservice(game, "ReplicatedStorage"), getservice(game, "RunService") local localplayer = players.LocalPlayer local folders = {} folders.SovaSystemMeleeR = waitforchild(replicatedstorage, "SovaSystemMeleeR") folders.Remotes = waitforchild(folders.SovaSystemMeleeR, "Remotes") local events = {} events.RequestAttack = waitforchild(folders.Remotes, "RequestAttack") events.OnHit = waitforchild(folders.Remotes, "OnHit") local utils = {} function utils.getClosestTarget() local closestPlayer = nil local closestDistance = math.huge for _, player in players:GetPlayers() do if not player then continue end local character = player.Character ; if not character then continue end if player.Team == localplayer.Team then continue end local forcefield = findfirstchild(character, "ForceField") ; if forcefield then continue end local localCharacter = localplayer.Character ; if not localCharacter then continue end local targetRootPart = findfirstchild(character, "HumanoidRootPart") ; if not targetRootPart then continue end local localRootPart = findfirstchild(localCharacter, "HumanoidRootPart") ; if not localRootPart then continue end local targetDistance = (targetRootPart.Position - localRootPart.Position).Magnitude ; if targetDistance >= closestDistance then continue end closestDistance = targetDistance closestPlayer = player end return closestPlayer end function utils.Attack(attackPlayer) if not attackPlayer then return end local localcharacter = localplayer.Character ; if not localcharacter then return end local weapon = findfirstchildofclass(localcharacter, "Tool") ; if not weapon then return end local target = {} target.player = attackPlayer ; if not target.player then return end target.Character = target.player.Character ; if not target.Character then return end target.Humanoid = findfirstchildofclass(target.Character, "Humanoid") ; if not target.Humanoid then return end target.Head = findfirstchild(target.Character, "Head") ; if not target.Head then return end weapon:Activate() events.RequestAttack:InvokeServer(1) events.OnHit:FireServer(target.Head, target.Humanoid) end getgenv().killAuraConn = nil if getgenv().killAuraConn then getgenv().killAuraConn:Disconnect() ; getgenv().killAuraConn = nil end getgenv().killAuraConn = runservice.Heartbeat:Connect(function() local target = utils.getClosestTarget() ; if not target then return end utils.Attack(target) end)