I have this short part of the script here that I'm using to kill everyone. Unfortunately it seems to only affect the first person. Can someone explain to me what is wrong?
for i,v in pairs(game.Players:GetPlayers()) do v.Character.Humanoid.Health = 0
Thanks
This should work, from what you put. Unless you want to loop it. Reply if you wanted something differently.
function onjoin(player) player:WaitForChild("Character") player.Character:WaitForChild("Humanoid") player.Character.Humanoid.Health = 0 end game.Players.PlayerAdded:connect(onjoin)
Give this answer a like if it helped :)
You can do this too
game.Workspace.CharacterAdded(function(Character)--if character added to workspace character.Humanoid.Health = 0--changes health to 0 end)
there maybe speeling check it once more before executing because i didnt check it
function KillAllPlayersCurrentlyInGame() for i,v in pairs(game.Players:GetPlayer()) do v.Character:WaitForChild("Humanoid").Health = 0 end end
This is a function that kills all players. To make this function run, you have to call it, like this.
KillAllPlayersCurrentlyInGame()
This function will only kill all the players in the game at the time you call it. It will not kill any players that join after you call it.
Please be more specific with your question.
Closed as Too Broad by Aethex, Perci1, and BlueTaslem
This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.
Why was this question closed?