You are on page 1of 1

local function PLR_VISIBLE(plr)

local IgnoreList = {game:GetService("Players").LocalPlayer.Character}


local NewRay = Ray.new(workspace.CurrentCamera.CFrame.p,
(plr.Character.HumanoidRootPart.Position - workspace.CurrentCamera.CFrame.p).unit *
2048)
local FindPart = workspace:FindPartOnRayWithIgnoreList(NewRay, IgnoreList)

if FindPart and FindPart:IsDescendantOf(plr.Character) then


return true
end

return false
end

while true do
wait()
pcall(function()
for i,v in pairs(game.Players:GetPlayers()) do
if v.Team ~= game.Players.LocalPlayer.Team and v.Character and
v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and
PLR_VISIBLE(v) == true then
local WeaponName =
game.Players.LocalPlayer.Character.EquippedTool.Value

if game.ReplicatedStorage.Weapons[WeaponName]:FindFirstChild("Chamber")
and (game.Players.LocalPlayer.Character.HumanoidRootPart.Position -
v.Character.HumanoidRootPart.Position).magnitude > 10 then
return
end

game.ReplicatedStorage.Events.HitPart:FireServer(unpack({
[1] = v.Character.Head,
[2] = v.Character.Head.Position,
[3] = WeaponName,
[4] = 100,
[5] = game.Players.LocalPlayer.Character.Gun,
[6] = nil,
[7] = nil,
[8] = 1,
[9] = nil,
[10] = false,
[11] = Vector3.new(),
[12] = math.rad(1,100000),
[13] = Vector3.new()
}))

getsenv(game.Players.LocalPlayer.PlayerGui:WaitForChild("Client")).firebullet()
wait(game.ReplicatedStorage.Weapons[WeaponName].FireRate.Value)
end
end
end)
end

You might also like