ADVERTISEMENTREMOVE ADS
magic bullet
47,538 views

Script Preview
Description
change keybind in the script, default is HOME
works for glock 17 and mp5 as a prisoner/criminal
automatically shoots through walls.
Features:
- Killall/Magic bullet
ADVERTISEMENTREMOVE ADS
186 Lines • 4.75 KiB
_G.FireGunAura = true
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local gunOwnerName = LocalPlayer.Name
local defaultGunName = "Glock 17"
local criminalGunName = "MP5"
local FIRE_DELAY = 0.15
local FOV_RADIUS = 150
local HOLD_KEY = Enum.KeyCode.Home
local isHoldingKey = false
local fovCircle = Drawing.new("Circle")
fovCircle.Radius = FOV_RADIUS
fovCircle.Thickness = 1
fovCircle.Filled = false
fovCircle.Transparency = 1
fovCircle.Color = Color3.fromRGB(0, 255, 0)
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == HOLD_KEY then
isHoldingKey = true
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == HOLD_KEY then
isHoldingKey = false
end
end)
RunService.RenderStepped:Connect(function()
fovCircle.Visible = _G.FireGunAura
local mousePos = UIS:GetMouseLocation()
fovCircle.Position = mousePos
end)
local function getCurrentGunName()
local team = LocalPlayer.Team
if team == Teams:FindFirstChild("Criminal") then
return criminalGunName
else
return defaultGunName
end
end
local function getRemote()
local currentGunName = getCurrentGunName()
local owner = workspace:FindFirstChild(gunOwnerName)
if not owner then return nil end
local gun = owner:FindFirstChild(currentGunName)
if gun and gun:FindFirstChild("Network") and gun.Network:FindFirstChild("Fire") then
return gun.Network.Fire
end
local backpackGun = Players[gunOwnerName]
and Players[gunOwnerName]:FindFirstChild("Backpack")
and Players[gunOwnerName].Backpack:FindFirstChild(currentGunName)
if backpackGun and backpackGun:FindFirstChild("Network") and backpackGun.Network:FindFirstChild("Fire") then
return backpackGun.Network.Fire
end
return nil
end
local function getGunOrigin()
local currentGunName = getCurrentGunName()
local owner = workspace:FindFirstChild(gunOwnerName)
if not owner or not owner:FindFirstChild("HumanoidRootPart") then
return Vector3.new(0, 0, 0)
end
local gun = owner:FindFirstChild(currentGunName)
if gun then
local muzzle = gun:FindFirstChild("Muzzle") or gun:FindFirstChild("Barrel") or gun.PrimaryPart or gun:FindFirstChild("Handle")
if muzzle and muzzle:IsA("BasePart") then
return muzzle.Position
end
end
return owner.HumanoidRootPart.Position
end
local function getDirection(from, to)
local diff = to - from
if diff.Magnitude == 0 then
return Vector3.new(0, 0, 0)
end
return diff.Unit
end
local function worldToScreen(pos)
local cam = workspace.CurrentCamera
local screenPos, onScreen = cam:WorldToViewportPoint(pos)
return Vector2.new(screenPos.X, screenPos.Y), onScreen
end
local function isInFOV(targetPos)
local screenPos, onScreen = worldToScreen(targetPos)
if not onScreen then return false end
local mousePos = UIS:GetMouseLocation()
return (screenPos - mousePos).Magnitude <= FOV_RADIUS
end
local function shouldAttackTarget(targetPlayer)
if not LocalPlayer.Team or not targetPlayer.Team then return true end
local localTeam = LocalPlayer.Team
local targetTeam = targetPlayer.Team
if localTeam == Teams:FindFirstChild("Inmate") or localTeam == Teams:FindFirstChild("Criminal") then
if targetTeam == Teams:FindFirstChild("Inmate") or targetTeam == Teams:FindFirstChild("Criminal") then
return false
end
end
if localTeam == targetTeam then
return false
end
return true
end
task.spawn(function()
while _G.FireGunAura do
if not isHoldingKey then
task.wait(0.1)
continue
end
local remote = getRemote()
if not remote then
task.wait(1)
continue
end
local origin = getGunOrigin()
for _, player in pairs(Players:GetPlayers()) do
if player ~= LocalPlayer and player.Character then
local head = player.Character:FindFirstChild("Head")
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if head and humanoid and humanoid.Health > 0 and shouldAttackTarget(player) and isInFOV(head.Position) then
local direction = getDirection(origin, head.Position)
local hitArgs = {
[1] = "HumanoidHit",
[2] = origin,
[3] = direction,
[4] = head,
[5] = head.Position,
[6] = humanoid,
[7] = 0.061
}
pcall(function()
remote:FireServer(unpack(hitArgs))
end)
local fireArgs = {
[1] = "FireGun",
[2] = origin,
[3] = direction
}
pcall(function()
remote:FireServer(unpack(fireArgs))
end)
task.wait(FIRE_DELAY)
end
end
end
task.wait(0.05)
end
end)
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS






Comments