How do I make a while loop stop on death?

How do I make a Serverwide while loop stop when the player dies? I don’t want the player to keep coughing and vomiting after they have reset / died.

game.ReplicatedStorage.Remotes.ARS.OnServerEvent:Connect(function(player)
	while true do
		if player.Character.Humanoid.Died:Connect() then
			
		end
	end
	
end)

Maybe like this?

if Humanoid.Health <= 0 then break end
https://www.lua.org/pil/4.4.html

3 Likes