Swimming connections continues to fire when player spams jump on water

For some reason the swimming connection seem to fire when player keeps jumping out of and in the water making the loop run forever.


Note the loop is running even when I’m not swimming.

Humanoid.Swimming:Connect(function()
	if not IsAlreadySwimming then
		if Regen.PlaybackState == Enum.PlaybackState.Playing then
			Regen:Cancel()
		end
		IsAlreadySwimming = true
		repeat 
			task.wait(1)
			print(DrownTime.Value)
			DrownTime.Value -= 1
		until DrownTime.Value == 0
		while IsAlreadySwimming do
			task.wait(1)
			Humanoid:TakeDamage(15)
			if DrownTime.Value > 0 then
				break
			end
			if not IsAlreadySwimming then
				break
			end
			if Humanoid.Health <= 0 then
				break
			end
		end
	end
end)
Humanoid.StateChanged:Connect(function(Old,New)
	if Old == Enum.HumanoidStateType.Swimming then
		IsAlreadySwimming = false
		Regen:Play()
	end
end)

Would this fix it?

repeat 
			if Humanoid.GetState() ~= Enum.HumanoidStateType.Swimming then
				IsAlreadySwimming = false -- Preventing player from taking damage when they're not swimming
                --might add a regen play here not sure?
				break
			end
			task.wait(1)
			print(DrownTime.Value)
			DrownTime.Value -= 1
		until DrownTime.Value == 0