local Network = require(game:GetService("ReplicatedFirst").Network)
local CollectionService = game:GetService("CollectionService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local KILL_DELAY = 0.1
local TARGET_PART = "Head"
local function GetTargets()
local targets = {}
for _, char in pairs(CollectionService:GetTagged("Players")) do
local ply = Players:GetPlayerFromCharacter(char)
if ply and ply ~= LocalPlayer and char:FindFirstChild("Humanoid") and char.Humanoid.Health > 0 then
if ply:GetAttribute("Team") ~= LocalPlayer:GetAttribute("Team") then
table.insert(targets, char)
end
end
end
return targets
end
local function FireHit(victim, weaponName)
local hitPart = victim:FindFirstChild(TARGET_PART) or victim:FindFirstChild("UpperTorso")
if not hitPart then
return
end
local hitData = {
{
Hit = victim,
PartName = hitPart.Name,
Position = hitPart.Position,
Normal = Vector3.new(0, 1, 0)
}
}
Network.FireServer("HitPart", hitData, weaponName, nil, nil, nil)
end
task.spawn(
function()
while task.wait(KILL_DELAY) do
local char = LocalPlayer.Character
if char then
local weaponName = char:GetAttribute("WhatGun")
if weaponName then
local enemies = GetTargets()
for _, enemy in ipairs(enemies) do
FireHit(enemy, weaponName)
end
end
end
end
end
)
Comments
No comments yet
Be the first to share your thoughts!