So I am working on a game with nukes, and below are some of the ways I detect the location of each player and determine if they are able to survive. All of the code works however, I ran into an issue when there are multiple players, the repeats will repeat until that player is dead and then it will effect the others. How can I make it so that everyone takes damage at the same time?
for _, player in pairs(game.Players:GetPlayers()) do
if player.Character then
if player.CurrentLocation.Value == "Bunker1" and bunkerOne.DoorClosed.Value == false then --If bunker one door is open
repeat
wait(1)
game.Workspace[player.Name].Humanoid.Health = game.Workspace[player.Name].Humanoid.Health - 10
until game.Workspace[player.Name].Humanoid.Health == 0 or bunkerOne.DoorClosed.Value == true
else
if magnitude <= maxDistanceBunker1 and player.CurrentLocation.Value == "Bunker1" then --If another player is in vault one
repeat
wait(1)
game.Workspace[player.Name].Humanoid.Health = game.Workspace[player.Name].Humanoid.Health - 10
until game.Workspace[player.Name].Humanoid.Health == 0
end
end
end
end
end
