I'm making a game with rounds, and at the end of each round all players are reset and then sent back to the lobby. My code below isn't resetting all players and I don't know what is wrong.
local playerstoreset = game.Players:GetChildren() for i = 1, #playerstoreset do if playerstoreset[i]:WaitForChild("Character") ~= nil then playerstoreset[i]:WaitForChild("Character").Humanoid.Health = 0
for i,v in pairs(game.Players:GetPlayers()) do v.Character.Humanoid.Health = 0 end