Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

how to kill all after the round ends?

Asked by
Gigaset39 111
2 years ago
Edited 2 years ago

i have a script that works,just that after the round is finished,i want that all the players will got killed,for this script to work proprely,how i do that?

 if #plrs == 1 then
        -- Last person standing --
        Status.Value = " The winner is: "..plrs[1].Name
        plrs[1].leaderstats.Bucks.Value = plrs[1].leaderstats.Bucks.Value + reward
        break

 elseif #plrs == 0 then
        Status.Value = "No one won"
        break
    elseif i == 0 then
        Status.Value = "Time is up!"
        break
    end

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

you can put this code snippet where you need to kill them all

for _,v in pairs(game.Players:GetChildren()) do -- loops through all players
if v.Character and v.Character:FindFirstChild("Humanoid") then -- checks if the player has a character and the character has a humanoid

v.Character.Humanoid.Health = 0 -- set their health to 0

end


end
0
doesent work.. Gigaset39 111 — 2y
0
is because im too NOOB Gigaset39 111 — 2y
Ad
Log in to vote
0
Answered by
Gigaset39 111
2 years ago

for i, v in pairs (game:GetService("Players"):GetPlayers()) do v.Character:FindFirstChild("Humanoid").Health = 0 end

Answer this question