Skip to content
RoRoScripts
Kill All preview
Unknown

Kill All

Script
Views
17K
Likes
2
Dislikes
2
Added
Script
-- variables
local run_service = game:GetService("RunService");
local players = game:GetService("Players");
local local_player = players.LocalPlayer;

-- script variables
local remote;

-- functions
local kill_player = function(player_humanoid)
    -- print("Killed:", player_humanoid.DisplayName);
    remote:InvokeServer(player_humanoid, math.huge);
end;

local start_mafia_boss = function(player)
    if (player == local_player or not local_player.Character) then
        return;
    end;

    print("added:", player);

    local npc_mode = player.Parent.Name == "Civilians";

    task.spawn(function()
        while task.wait(1) do
            if (not remote) then
                return;
            end;

            local player_character = npc_mode and player or player.Character;
            if (not player_character) then
                return;
            end;

            local humanoid = player_character:FindFirstChild("Humanoid");
            if (not humanoid) then
                return;
            end;

            kill_player(humanoid);
        end;
    end);
end;

-- grab remote
remote = local_player.Character and local_player.Character.Weapons.Primary.Gun.GunScript.DealDamage;

-- kill all players
for _,v in players:GetPlayers() do
    start_mafia_boss(v);
end;

players.PlayerAdded:Connect(start_mafia_boss);

-- kill all npcs
for _,v in workspace.Map.Civilians:GetChildren() do
    start_mafia_boss(v);
end;

workspace.Map.Civilians.ChildAdded:Connect(start_mafia_boss);

-- connections
local_player.CharacterAdded:Connect(function(v)
    repeat task.wait(.1) until v:FindFirstChild("Weapons");
    remote = v.Weapons.Primary.Gun.GunScript.DealDamage;
end);